Forum Discussion
TesterNo1
Contributor
Thanks Rao.
Sometimes we tend to run our test cases one by one for debugging.In that case,i need to have tear down copied to each and every test case instead of suite level.That is why i thought it better be handled from event so it will be in one single place.Easy to make changes since code is in one place.
what happens is testRunner.gotoStep("SQLWrite") does work when invoked from inside the event but it doesnt trigger when inside the below if condition.
import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStepResult import com.eviware.soapui.model.testsuite.* import com.eviware.soapui.impl.wsdl.teststeps.RestRequestStepResult import com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep def xmlUtils = new com.eviware.soapui.support.xml.XmlUtils(); if (!testStepResult.getStatus().toString().equals("OK")) { testStatus=testStepResult.getStatus().toString() currentTestStep=context.getCurrentStep().getLabel() testCaseComment=currentTestStep //log.info warnMsg def TestCase = testRunner.getTestCase().getName() log.info TestCase testRunner.testCase.getTestStepByName("TestRunnerProperties").setPropertyValue("TestLastFailedStep",testCaseComment) testRunner.testCase.getTestStepByName("TestRunnerProperties").setPropertyValue("TestCaseStatus",testStatus) testRunner.gotoStep("SQLWrite") context.getTestRunner().gotoStepByName("SQLWrite") }
TesterNo1
9 years agoContributor
Rao,
i tried RunTestStepbyname followed by testrunner.fail and it did the job.
Thank you :-)
Related Content
- 2 years agonastester