How do I pass a test case while ignoring only certain failed test steps?
I have a test case that has multiple test steps. Two of them are calling a REST endpoint that was not developed by my organization. It's essentially an API for viewing a log. However, sometimes when calling the API, it fails. No payload is returned, no HTTP status is returned, it is a null payload. I have accounted for this by not putting any assertions on the test step and I have a groovy test step right after to evaluate the payload. If the payload is null, I return to the to REST call and run it again. Once it returns a payload, the groovy script will allow the test case to move to the next step.
When the test case completes, if one of the API calls failed the entire test case is failed even though it eventually passed. It seems that the test case is looking at the log and if any test step failed at any point, the test case failed.
How can ignore the failures only for those specific REST calls? If any other test step fails, I still want to the test case to fail. I have attempted to add a script to disable the "Fail TestCase if it has failed TestSteps" option before the REST steps and then re-enable it after they have run, but the test case still fails.
Thank you in advance for any help.
Ok so it seems that you don't even have to use a try catch statement. Just disable the step for which you want to ignore the result and call it from a groovy script as:
// Get the test step for which you want to ignore the result def testStep = testRunner.testCase.testSuite.testCases[ "NameOfYourTestCase" ].testSteps[ "NameOfYourTestStep" ] // Run the test step testStep.run( testRunner, context )
I attached a demo project at https://github.com/lucadln/soapui/tree/master/IgnoreFailedStep .