Execute next testcase when the previous one failed
I have the following setup:
- A testsuite with 2 testcases TCA and TCB.
- Each testcase contains 3 teststeps (TSA1, TSA2, TSA3 & TSB1, TSB2, TSB3).
- In TSA2 I have added an assertion that makes the teststep fail.
- I'm executing the SoapUI project via the soapui-maven plugin in Jenkins.
When executing via Jenkins, it runs TCA and fails at TSA2, and therefor it does not execute TSA3 (which is fine), but it does not start TCB (which it should execute).
In SoapUI itself there is an option on the testcase level "Abort test if an error occurs" which is enabled by default.
So i disabled it on both testcases and rerun it via Jenkins:
When running TCA it fails at TSA2 but now it runs TSA3 (which should be skipped), and afterwards it runs TCB (which is what I need). So using the "Abort test if an error occurs" option does not provide a solution to my problem.
How can I make it possible that if a teststep fails in a testcase:
- it does not execute the next teststep(s) of the same testcase
- it does execute the next testcase(s)
Any help is appreciated!
In that case, as far as my knowledge says, no inbuilt feature is there in ReadyAPI where you can do this.
For this you need to write bit groovy in each step to achieve this. or you can create a run controller which execute all your TestCases via groovy only(but this needs too much coding)
Write Script Assertion, which check whether the Step is passed or not,
if step status == passed(validating this by userName or by response Header or if using SOAP then by status)
{
'do nothing
}
else
{
'disable next steps
context.testCase.getTestStepByName("RetrieveData").setDisabled(true)
context.testCase.getTestStepByName("DeleteData").setDisabled(true)
}
And write below code in TearDown of your TestCase to again Enable those TestCases.
context.testCase.getTestStepByName("DeleteData").setDisabled(false)
Click "Accept as Solution" if my answer has helped, and remember to give "kudos" :)
Thanks and Regards,
Himanshu Tayal