Forum Discussion
JHunt
7 years agoCommunity Hero
If you want a variable to persist outside of an individual script, you can set it into the WsdlTestRunContext. Make sure you are running the TestCase, rather than just running the script in the editor.
assert context instanceof com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext
assert testRunner instanceof com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner
int maxRuns = 2
if (!context.runCount) context.runCount = 1
if (context.runCount++ >= maxRuns) {
return
} else {
testRunner.gotoStepByName("Some earlier TestStep")
return
}
Context is a type of Map, so the above is essentially doing this:
int count = 1
if (context["runCount"] == null) {
context += ["runCount": count]
}
Specifically, it is a StringToObject map, so you can put any variable you want into it.
class person { String firstName String lastName } context.theGuy = new person(firstName: "John", lastName: "Smith")
Related Content
- 6 years ago
Recent Discussions
- 2 days ago
- 2 days ago