Forum Discussion

tclotworthy's avatar
tclotworthy
Contributor
9 years ago

Having Difficulty Passing Parameters Between Test Steps in a Test Case (REST Project)

Hello,

 

I am using SoapUI Open Source (REST program), and I am having difficulty figuring out how to do the following:

 

1) retrieve a parameter from a response returned from web service call — say, returned from Step 1 of TestCase1

2) take that response and pass it as a http method inputParam to Step 2 — e.g., http://endpointwhatever/someServiceCall?val1=inputParam 

 

I found some guidance for this assuming I were to purchase SoapUI Pro, but I really don't want to do that just to perform what I assumed would be a fairly straightforward functionality.

 

Grateful for any response,  Thanks!

  • tclotworthy's avatar
    tclotworthy
    9 years ago

    Hi Rao,

    I was able to get this to work via the Parameter Transfer tool in SoapUI. I had started a separate thread in the SoapUI NG forum here. Thanks for your help. If I can figure out how, I am going to say that this question is answered. Thanks again!

  • nmrao's avatar
    nmrao
    Champion Level 3
    Can you post raw response of #1 and which value out of it needs to be passed to #2?
    • tclotworthy's avatar
      tclotworthy
      Contributor

      Hi Rao, thanks for your response. I wish I had noticed it earlier. Here is sample output:

       

      HTTP/1.1 200 OK
      Content-Type: text/xml
      Date: Wed, 06 Jan 2016 18:25:00 GMT
      Connection: keep-alive
      Transfer-Encoding: chunked

      PlanID: 50027

       

      Its the PlanID we want as input to the next test step (next step basically will be endpoint like: someEndpoint/updatePlan?PlanId=whatever

       

      Thanks for any response and Happy New Year!

       

       

      • tclotworthy's avatar
        tclotworthy
        Contributor

        ok, I have figured out how to extract response from a test step. Here is example groovy step that works:

         

        def response = context.expand( '${CreatePID#Response}' )

         

         

        So, now I have the input I want for my next test step (response). I simply want to be able to do something where the next step corresponds to calling a restful endpoint such as: 

         

        someEndpoint/updatePlan?PlanId=response

         

        , where "response" is the value I extracted from the previous step.

         

        So, I would be grateful for anyone who might know how to take that "response" and pass to next step to accomplish what I indicated above in bold. Thanks!