Forum Discussion
PaulDonny
11 years agoRegular Contributor
Hi Rory, nice little script you have there. The issue with your script is that your quotes inside of the context.expand are not escaped and thus your current groovy script is trying to handle them. In order to fix this issue, either escape the quotes or switch them. I switched them.
and that worked for me.
I did have a few suggestions for the script though:
1) Have it check if the TC exists, if this is being ran from command line than no big deal here.
2) Possibly having a teardown script to handle a lot of this would be useful.
3) Have you ever looked into having groovy control the flow of your test cases?
If you would like I could show you an example script where the test case never actually leaves your groovy script
import com.eviware.soapui.impl.wsdl.teststeps.registry.GroovyScriptStepFactory
def tc1 = testRunner.testCase;
gs = tc1.addTestStep( GroovyScriptStepFactory.GROOVY_TYPE, "rerun/cleanup" )
gs.properties["script"].value = 'def response = testRunner.testCase.testSteps["createClaim"].testRequest.response.contentAsString \nif (response.contains("Error processing query") == true) \n{ \ntestRunner.gotoStep(0) \n} \ndef uniqueId = context.expand( "${#TestCase#testCase}" )';
and that worked for me.
I did have a few suggestions for the script though:
1) Have it check if the TC exists, if this is being ran from command line than no big deal here.
2) Possibly having a teardown script to handle a lot of this would be useful.
3) Have you ever looked into having groovy control the flow of your test cases?
If you would like I could show you an example script where the test case never actually leaves your groovy script
Related Content
- 5 years agohenil_shah
- 11 years agotestlc