MPleas
11 years agoOccasional Contributor
Run TestCase from Groovy isn't returning properties
Hi! We are implementing an external data source for use with our SoapUI Pro tests. Our current plan is to have each test have the first step be a Groovy step that is basically the manager of the test. The SoapUI test will be designed just like any normal test, the exception is that it will have this first Groovy step. The Groovy step will grab the data from the external data source. The Groovy step is going to execute all of the steps in the SoapUI test through the Groovy script. This allows us to control the data, looping, etc. The Groovy step will basically iterate through all of the steps in the test and run them. At the end of the Groovy script it cancels the run since all steps were run by the Groovy script and we don't want the steps to run again.
This works great and does what we want, except for when the test step is "Run TestCase" step. The test step is setup to return properties back to the calling test. However, these properties are not being returned back to the test.
Basically we're using s.run( testRunner, context ) to run the step that is the 'Run TestCase' step.
At the end of the Groovy script it uses testRunner.cancel to end the test. This is because the initial Groovy step went through and executed each of the steps via the Groovy step and we don't want them to run again.
I'm wondering if it's this testRunner.cancel within the called test that is causing the properties not to return back to the test? Is there another way of ending the test via Groovy script without 'cancelling'? It doesn't appear that there is a 'finish' method or 'break' method that would allow the test to finish without 'cancelling' it.
This works great and does what we want, except for when the test step is "Run TestCase" step. The test step is setup to return properties back to the calling test. However, these properties are not being returned back to the test.
Basically we're using s.run( testRunner, context ) to run the step that is the 'Run TestCase' step.
At the end of the Groovy script it uses testRunner.cancel to end the test. This is because the initial Groovy step went through and executed each of the steps via the Groovy step and we don't want them to run again.
I'm wondering if it's this testRunner.cancel within the called test that is causing the properties not to return back to the test? Is there another way of ending the test via Groovy script without 'cancelling'? It doesn't appear that there is a 'finish' method or 'break' method that would allow the test to finish without 'cancelling' it.