Forum Discussion

Markal's avatar
Markal
Occasional Contributor
8 years ago
Solved

Failing test cases

Hi!
I'm working with SOAPUI NG PRO and ran into the following issue:
In a test case I have many test steps. I would like to create a "hierarchy" between them. So for example:
testStep4 - checks if a field exists in the response

testStep4.1 - counts if the field is only present once

testStep4.2 - checks the value of the field

testStep5 - next main test step

 

If testStep4 fails I would want to:

1. Fail 4.1 and 4.2 without executing them

2. Continue from testStep5

 


I have a groovyscript (branching path1) which decides what to do. It's after testStep4. I can do the skipping part by: testRunner.gotoStepByName("testStep5") but I couldn't find a solution for setting testStep4.1 and 4.2 to failed. I googled it but could not find a solution.

How would you guys take care of this? Or if you have any idea how to work around this, please tell me!
Thanks!

  • Try using "Conditional Goto" testStep make a condition for each posibility using xpath expression. I think that's a better way.

5 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    May be you forgot one thing, if testStep4 is failed, then the next groovy script is not even executed, is not it so?
    • Markal's avatar
      Markal
      Occasional Contributor

      The script runs if testStep4 fails. This is how I know the jump works correctly.

    • Markal's avatar
      Markal
      Occasional Contributor

      Any other suggestion? Or can you point me to a direction where I might find a solution to this problem?

      • nmrao's avatar
        nmrao
        Champion Level 3
        Place the groovy script first.
        Then run the step4 from groovy.
        Evaluate the conditions as you needed.
  • Try using "Conditional Goto" testStep make a condition for each posibility using xpath expression. I think that's a better way.