How to stop testSuite with many TestCases even if one test step in any testCase fails?
Hi, is there a way to stop whole test Suite even if any testStep fails in any TestCase ?
I have one test suite which has 3 Test cases. Each test case has many test steps and in all test steps, I am using contains assertion. As of now if any assertion fails , only that TestCase fails, but I want to stop whole test suite if any test step in any test case fails immediately. Please help me if it is doable with script assertion and if so how exactly ?
As far as I know there is no out-of-the box setting which you could simply use. You can use the following workaround:
Set a SetUp script for your test suite:
testSuite.setPropertyValue("TestSuiteResult", "OK")
For each of your test cases within the suite set a:
- SetUp script:
assert (testCase.testSuite.getPropertyValue("TestSuiteResult") != "FAILED")
- TearDown script:
if (testRunner.getStatus().toString() == "FAILED") { testCase.testSuite.setPropertyValue("TestSuiteResult", "FAILED") }
These scripts stop the execution of the next test case if one test case fails.
For each of your test cases also switch on the option "Abort On Error". You can do that in a test case editor. The test case will stop with a first test step failure.
Just a comment:
A test suite has a method setAbortOnError(bolean) in the SoapUI API, however if you set this property to true, it does not prevent execution of the next test case if a test case fails.