Menu

Invoking a test script

Help
2010-03-30
2013-02-18
  • Aanchal Gupta

    Aanchal Gupta - 2010-03-30

    Hi,

    Is there any way of running my test script without using threads?
    If I am sure that I will only execute one thread at a time, then there is no need of creating threads…

    Also, is it necessary that my test-script(written in Java) has to be there in the test() function only of a class extending DefaultJavaTestScript Class?

    What I want to ask is that can we run a test using any method except for creating an AutomatedRunnable?

     
  • Robert Pes

    Robert Pes - 2010-03-30

    Have you read the documentation? I believe all the answers are there:

    http://www.vncrobot.com/docs/v2.0/api/docs/javatestscripts.html
    http://www.vncrobot.com/docs/v2.0/api/com/tplan/robot/scripting/DefaultJavaTestScript.html
    http://www.vncrobot.com/docs/v2.0/api/com/tplan/robot/scripting/JavaTestScript.html

    Is there any way of running my test script without using threads?
    If I am sure that I will only execute one thread at a time, then there is no need of creating threads…

    Java test script is just a Runnable, not a thread. If you run just one test script you may call just its run() method instead of passing it to a Thread instance.

    Also, is it necessary that my test-script(written in Java) has to be there in the test() function only of a class extending DefaultJavaTestScript Class?

    Citing from documentation:

    An alternative approach is to make your class to implement the JavaTestScript interface. Though this is sufficient for T-Plan Robot framework to execute such a test script, you won't have direct access to the functional methods defined in the DefaultJavaTestScript class. A workaround is to create an instance of this class with the test() method empty and then call its methods from your code. See the class documentation for an example.

    What I want to ask is that can we run a test using any method except for creating an AutomatedRunnable?

    The underlying functionality depends on global services initialized by the ApplicationSupport, such as resource bundle with software messages or user configuration. Some methods might work without it but in general I wouldn't be surprised to see just a bunch of NullPointerExceptions if you call them directly without proper initialization.

     
  • Aanchal Gupta

    Aanchal Gupta - 2010-04-01

    Thanks for the prompt reply.. :)

    I had gone through the documentation..
    What I got was that my test script can either be in the DefaultJavaTestScript's test() method or in the JavaTestScript Interface's test() method.
    I was just looking for a way so that I do not have to use either of these, but could create my test script in any method of my own and then execute it…
    If there is any way pls let me know…
    If u could provide me with an example, it would be great!!!

     
  • Robert Pes

    Robert Pes - 2010-04-02

    There's no way to avoid the standard mechanisms. The tool needs to know which method to execute. This is expressed by the JavaTest interface. As the internal functionality requires a proper initialization, the test runnable must be instantiated through the createAutomatedRunnable() method. These two basic requirements can't be bypassed unless you want to dive in to the source code and rewrite completely the whole framework. It's as simple as that.

     

Log in to post a comment.