Forum Discussion

gordonb's avatar
gordonb
Occasional Contributor
12 years ago

Test step fail then pass, test case is status fail

My test case has a
SOAP step
Groovy step

When the SOAP step fails, it correctly sets the test case status to red & FAILED.

However, the Groovy step can rerun the SOAP step. If the SOAP step subsequently passes, the test case is incorrectly left at FAILED.

I would expect the test case status to be changed to green & FINISHED.

There may be a way to wrestle with system properties, but I would prefer for test case to go green.
  • nmrao's avatar
    nmrao
    Icon for Champion Level 2 rankChampion Level 2
    Hi,

    Assuming that both steps needs to be run in order to get the correct result.

    It is little confusing from the post that, "re-run from groovy" which is a second step. Would you please add more details?
  • gordonb's avatar
    gordonb
    Occasional Contributor
    The SOAP step is a standard request, with standard assertions.
    However, sometimes the response contains "security failed". i.e. the login wasn't accepted.
    So the groovy step looks for "security failed" in the response and then runs testRunner.gotoStepByName("StandardRequest").
    After a couple of tries the SOAP step won't have a "security failed".
    Crazy but true.
  • nmrao's avatar
    nmrao
    Icon for Champion Level 2 rankChampion Level 2
    Hmm..strange really that security fails inconsistently.
    1. Have you check in your application logs if the request is hitting server and getting security failed response in the first place? Becuase, it could be an application defect as well.
    2. Coming to the actual question, are you using assert in groovy step to check the previous step response before re-running? If so, that could be the culprit for making the test case failed. Instead of assert, try using if condition.
  • This sounds like it works as it should. Once you fail a test step, test case fails. And once the test case is flagged as failed, SoapUI does not reset it to passed in the same run.

    The fact that you are rerunning the step doesn't matter. Think about Data driven testing; there by design you are running the same step many different times looking for a failure, and once you encounter it you fail the test case.

    nmrao had the right suggestion to use a script assertion that doesn't fail the first step if the login wasn't accepted.

    Michael Giller
    SmartBear Software