Forum Discussion

peterebels's avatar
peterebels
New Contributor
9 years ago

transfer parameter to groovyscript...

The following teststeps are executed 

 

 

REST - post step

ID - transferstep

get request (take ID from step above)

ID - transferstep

HTTP - get step (take ID from step above)

the get will initiate a process and it will take a while...

 

so that the process wont fail we have adapted it to

 

 

REST - post step

ID - transferstep

get request (take ID from step above)

delay(500)

ID - transferstep

HTTP - get step (take ID from step above)

 

But the problem is. On different systems it will take a different amount of time...

 

 

so we try to execute a groovyscript instead the last two ones....

 

 

This is one of my first try of groovy scripting,...

 

 

import com.eviware.soapui.model.testsuite.TestRunner.Status
// import com.eviware.soapui.model.testsuite.TestStepResult
import com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus
def maxretry = 3
def mydelay = 2000
def mystatus = 0
def j = 0
log.info ("define variable maxretry: " + maxretry + " n")
log.info ("define variable mydelay: " + mydelay + " ms")

mystatus = testRunner.runTestStepByName("verify").getStatus() while(mystatus != TestStepStatus.OK && j < maxretry) { sleep(mydelay) j = j + 1 log.info ("working a while... and wait another " + mydelay + " ms iteration("+j+")") log.info ("check status now: " + mystatus) log.info ("counter "+ j) mystatus = testRunner.runTestStepByName("verify").getStatus() }  

Steporder is currently the lines below

 

REST - post step

ID - transferstep

get request (take ID from step above)

ID - transferstep

groovyscript

HTTP - get step (take ID from step above) (DEACTIVATED)

 

 

 

Can anybody give me a hint to solve this problem....

    • peterebels's avatar
      peterebels
      New Contributor

      If so, sorry for that. Can I correct my mistake?

       

       

  • No problem just thinking you will get better help over there. ;). A mod has to fix it though.
      • peterebels's avatar
        peterebels
        New Contributor

         

         

        The first step is the post request. In this step the response will give me a request-id which is created randomly in the request by

         

        ${=java.util.UUID.randomUUID()}

         

         

        this post action will take a while, the action itself will be fast. but our softeware execution time is not as fast as intended....

        the software will send a respondmessage to our mockservice. After that we want to check, if the software has responded to mock. If soap UI is to fast executing the teststeps.

         

        We will check if the mockservices has received the notification before our software has sent the notification and therefor the step will fail.

         

        To overcome we have delayed the teststepprocedure which tries to find out, if the notification is send to the mock.

         

        So:

         

        post ---- create --- tid & send notification to mock

        verify with tid

         

         

        I want to

         

        post --- create tid & send notification to mock.

        try to verify with tid via groovy script which tries to retry 10 times (for example) and fail if and only if maxretry is reached and status is FAIL but proceed with next teststep if verify is OK and maxretry is not reached...

         

         

        I hope this is as specific enough as required....

         

        best regards


        Peter