Forum Discussion

Vivek_Malhotra's avatar
Vivek_Malhotra
Occasional Contributor
8 years ago
Solved

Repeat a Test Step until you get desired response and then move to next step.

Hi, I have a requirement where I am querying using a GET Request or say a DB select.   This is async service which returns me a state say "in-progress" . Then I added a step called delay with 2 se...
  • nmrao's avatar
    nmrao
    8 years ago

     

    def response = context.expand( '${TestStep_101#Response}')
    def holder = new com.eviware.soapui.support.XmlHolder(response)
    if (holder) {
       def isRetry = true
       while(isRetry) {
            def state = holder.getNodeValue('//*:payments/*:payment-state')
            log.info "value of state in the response is ${state}"
            if (state == 'success') {
                log.info "Since the value is success, setting value of isRetry to false"
                isRetry = false
            } else {
               log.info "Retring as state is not success"
               testRunner.runTestStepByName('TestStep_101')
            }
       }
    }

     

    Please check if the above script helps.