Forum Discussion
If you wish to run it only if the testcase fails, you need to add if condition and then get the testStep from other testSuite first,
import com.eviware.soapui.impl.wsdl.WsdlProjectPro
WsdlProjectPro project = new WsdlProjectPro("Project Path");
TestSuite testSuite = project.getTestSuiteByName(testSuiteName) ;
TestCase testCase =testSuite.getTestCaseByName(testCaseName)
TestStep testStep = testCase.getTestStepByName(stepName)
testStep.run(testRunner, context)
You can either add this in groovy script set it as target for conditional go to
http://www.soapui.org/functional-testing/teststep-reference/conditional-goto/conditional-goto.html
Or create a logic using groovy to run this script if there is a failure
Thank you so much!
Your answer really helpfull.
I would like to explain you, what I want and don't want to do:
what I do not want to do:
- Add new groovy script into each-other test-case, because it's take a long time and quite difficult to support.
what I want to do:
- Use event handler, once add groovy script which will using for all test-cases (TestSuiteRunListener.afterTestCase).
But I don't know how can I get current result of test-case, in the moment of running TestSuiteRunListener.afterTestCase for adding if condition in this script.
Could you provide an example how can I get the result of test-case (passed or failed) in groovy script if this script will located in Events handler.
I hope I explained what I need :))
- nmrao10 years agoChampion Level 3
Here is the script which you might be interested in:
import com.eviware.soapui.model.testsuite.TestRunner.Status if (testRunner.status == Status.FAILED) { //do the stuff you needed }
Hope this is useful
- nsalomatin10 years agoOccasional Contributor
I tried this script.
Unfortunately, when running TestSuite RunListener.after TestCase, test runner has status = Running.
Do you have any suggestion, how can I get current results in the moment when running afterTestCase? - nmrao10 years agoChampion Level 3Sorry, did not understand your comment.
- nsalomatin10 years agoOccasional Contributor
if (testRunner.status == Status.FAILED) { //do the stuff you needed }
I told about code above. When execute this code in events, than testRunner always has status "RUNNING", not "FINISHED", not "FAILED" even if test-case fails, understand?
Related Content
- 4 years ago
- 14 years ago
Recent Discussions
- 15 hours ago