Forum Discussion

HaroldR's avatar
HaroldR
Contributor
7 years ago
Solved

Re: testRunner/Context Object in groovy script

Hey, 

I would like understanding how to use testRunner in differents cases :
1)Inside Setup Script at at Project level

2)Inside Setup Script at at TestSuite level

3)Inside Setup Script at at TestCase level
4)Inside a groovy script TestStep

For the moment, I'm only able to use testRunner Class inside a groovy script test step. Each time I try to use testRunner variable inside another context (for instance, Project/TestSuite/TestCase Script Level), the result is a compilation error which said that I try to use a missing property.

Any help to this issue would be really appreciated.

Regards,

Harold

  • Requesting to have a look at the right top of the script editor (for the mentioned cases) including Groovy Script test step. That shows the initialized variable names available for the user to use in the respective level.

    You may notice that `testRunner` is only available for Groovy Script and there are different objects for the other cases.

    However, 'context' is available in all the cases.

    Hope this clarifies

  • nmrao wrote:
    Requesting to have a look at the right top of the script editor 

    Thaks for the reply nmrao,
    That's the solution. Finally, you just have to take a look to all variables mentioned at the top right of every script. At first glance, I did not notice that there were differents from a window to another.

    Also, I asked this question in another forum and the person who gave me the explaination did it very well, here it is :

    1) At project level - you will find either 'Setup script' and 'TearDown script', where you can use project variable (which is an instance of com.eviware.soapui.impl.wsdl.WsdlProject). Remember it is not equivalent to testRunner.

    2) At testsuite level - you will find 'Setup script' and 'TearDown script', where you can use runner variable. This is equivalent to testRunner, but it is an instance of com.eviware.soapui.impl.wsdl.panels.support.MockTestSuiteRunner
    3) At testcase level - you will also find 'setup script' and 'teardown script', where you can use testRunner variable which is an instance of com.eviware.soapui.impl.wsdl.panels.support.MockTestRunner

2 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    Requesting to have a look at the right top of the script editor (for the mentioned cases) including Groovy Script test step. That shows the initialized variable names available for the user to use in the respective level.

    You may notice that `testRunner` is only available for Groovy Script and there are different objects for the other cases.

    However, 'context' is available in all the cases.

    Hope this clarifies
    • HaroldR's avatar
      HaroldR
      Contributor

      nmrao wrote:
      Requesting to have a look at the right top of the script editor 

      Thaks for the reply nmrao,
      That's the solution. Finally, you just have to take a look to all variables mentioned at the top right of every script. At first glance, I did not notice that there were differents from a window to another.

      Also, I asked this question in another forum and the person who gave me the explaination did it very well, here it is :

      1) At project level - you will find either 'Setup script' and 'TearDown script', where you can use project variable (which is an instance of com.eviware.soapui.impl.wsdl.WsdlProject). Remember it is not equivalent to testRunner.

      2) At testsuite level - you will find 'Setup script' and 'TearDown script', where you can use runner variable. This is equivalent to testRunner, but it is an instance of com.eviware.soapui.impl.wsdl.panels.support.MockTestSuiteRunner
      3) At testcase level - you will also find 'setup script' and 'teardown script', where you can use testRunner variable which is an instance of com.eviware.soapui.impl.wsdl.panels.support.MockTestRunner