Forum Discussion

ABCDEFG's avatar
ABCDEFG
Contributor
13 years ago

Simple 'GO TO' Implementation

Hi,

How can we implement simple 'Conditional GO TO' for looping a test case(having multiple test steps) for 5 Times?

Appreciate your help in advance!

^Regards

7 Replies

  • deepesh_jain's avatar
    deepesh_jain
    Frequent Contributor
    I don't think you can use goto statement for this, unless you are validating a parameter from a response. Conditional goto statment will validate an xpath expression and will transfer the control to a test step based on the evaluation of xpath expression.

    So if you are expecting a specific value in a specific xpath expression on your 5th run, you can provide that as an expression, and put the condition so that unless that satisfies the control always goes back to step 1. Once this expression is satisfied, it can come out of loop.

    If you need to loop the test steps in a test case 5 time without validating the xpath expression in your response, the best bet is to use data source and data source loop available in soapUI Pro.

    Other than that, you will have to rely on Groovy script.
  • Thank you Deepesh for the reply.

    I do not have soapUI Pro License. Lets work on soapUI and focus on first solution - Xpath Expression.

    I have put Xpath exp. and if i am getting expected value. How can we compare and value in the GO TO step with expected?

    Ref: please find attached Go To step screenshot with this.

    Thanks

    ^Regards
  • deepesh_jain's avatar
    deepesh_jain
    Frequent Contributor
    Hi,

    You XPATH expression should be something like this if you are checking the value:

    exists (//ns2:sCountryISOCode[text() = "YOUR_VALUE_HERE"] )

    This will check the value of node sCountryISOCode if it matches and condition passes it will pass the control to the step mentioned in your screen shot. I am however assuming you would want to pass the control UNTIL you get this value. In that case, you can use the below expression:

    not (exists (//ns2:sCountryISOCode[text() = "YOUR_VALUE_HERE"] ) )

    Let me know if this works.

    Regards,
    Deepesh Jain
  • Thank you Deepesh. GO TO works well. :-)
    I appreciate your help.

    Is 'Exists' a function in Groovy? or else how can i learn more these functions for implementing 'GO TO'?

    I could ask you to solve one more problem that i have,
    Currently i have challenge to parametrize my test case and test cases is executing indefinitely.

    I have put 5 parm's in the test suite properties and parametrize it for that many times. but i cannot do it dynamically.
    Please find the attached screenshots and help me out

    ^Thanks
  • deepesh_jain's avatar
    deepesh_jain
    Frequent Contributor
    As i mentioned earlier, your best bet would be to use groovy scripts for this.

    Regards,
    Deepesh Jain
  • Sure, Thank you. :-)

    Can you suggest some easy ways to learn the Groovy?

    ^Thanks