Ask a Question

Can not insert 'run script routine' into a keyword test.

conehead
Occasional Contributor

Can not insert 'run script routine' into a keyword test.

I have a opened keyword test and want to insert 'run script routine'. When I attempt this I'm getting a TestComplete message 'No tests were found in you project suite.'


As mentioned, I'm already in a keyword test and am trying to insert the 'run script routine' operation. Can someone explain to me what 'No tests were found in your project suite.' means?  Does it have something to do with inserting the 'run script routine'?

 

Thanks in advance.

8 REPLIES 8
tristaanogre
Esteemed Contributor

Do you have, in your project, a "Script" project item with at least one code unit with at least one function/procedure within that unit?  If not, then "Run Script Routine" won't work for you because there are no script routines actually in your project.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
conehead
Occasional Contributor

No I did not. That clears up the 'No tests were found...' error message.

 

Thanks for the scoop.

I do have a script listed in Project Explorer under <Project Suite> -> <Project Name> -> Advanced -> Script , but the "Run Script Routine", when selected, still presents "No tests were found in your project suite." message.  Do I have the script routine located in the wrong directory or is there some environment variable needing added or configured?


@socaltester wrote:

I do have a script listed in Project Explorer under <Project Suite> -> <Project Name> -> Advanced -> Script , but the "Run Script Routine", when selected, still presents "No tests were found in your project suite." message.  Do I have the script routine located in the wrong directory or is there some environment variable needing added or configured?


The script in project explorer is a file that should contain functions, methods, etc.  You can't just add a file.  In that file, do you have method defined?  (what code language are you using?)

 

For example, if you have a file that is JavaScript, you can't just do this:

 

//This is a script file

var MyName = "Test";
Log.Message(MyName);

You need to put your code into a function:

 

//This is a script file

function MyTest(){
var MyName = "Test";
Log.Message(MyName);
}

Depending upon the language you're using the syntax may differ, but that's basically the problem.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

I inherited a TC project based on VBScript. This is the code:

 

Set browser = Sys.WaitProcess("iexplore", 1000)

    dw((browser.Exists))

          browser.Terminate()

          browser.Sys.WaitProcess("iexplore", 1000)

 

 

'dw' is a "do loop"

Okay. I think I got it working using your recommendation:

 

Function CloseIE()

Set browser = Sys.WaitProcess("iexplore", 1000)

    do while((browser.Exists))

          browser.Terminate()

          browser.Sys.WaitProcess("iexplore", 1000)   

    loop

End Function

 

+++++++

 

It works, but when iexplore exists it terminate it and then throws an exception "Object Required" with line 3 highlighted as the culprit. [do while((browser.Exists))].

 

Change your code to

 

Function CloseIE()

Set browser = Sys.WaitProcess("iexplore", 1000)

    do while((browser.Exists))

          browser.Terminate()

          Set browser = Sys.WaitProcess("iexplore", 1000)   

    loop

End Function

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

Hi,

 

Just my $0.02...
While Robert posted code that is highly expected to work, I would add one more line to the While loop:

Function CloseIE()
  Set browser = Sys.WaitProcess("iexplore", 1000)
  do while((browser.Exists))
      browser.Terminate()
      Call browser.WaitProperty("Exists", False, 30000)
      Set browser = Sys.WaitProcess("iexplore", 1000)   
  loop
End Function

The added line will delay for maximum 30 seconds to wait for the browser to be terminated.

The reason for this delay is that it may take some time to the OS to terminate the process and TC may obtain the reference to the process that is under termination and the attempt to terminate the process that is in the unstable state might cause sporadic runtime failures.

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
cancel
Showing results for 
Search instead for 
Did you mean: