Forum Discussion

dipit's avatar
dipit
New Contributor
8 years ago

How to make multiple Rest Requests with different properties each time?

 

I am very new to Groovy Script and SoapUI and facing a lot of problems.

 

So I wanna make a Rest Request with different values each time.

I have two properties

Property 1: h[0]=1,2

Property 2: h[0]= 3,4

 

So I wanna make a Rest Request first with Property 1 and once its complete , there should be another rest request with Property 2.

I am trying to us runTestStepByName in groovy script but still struggling.

 

Can somebody help?

2 Replies

  • Hi,

     

    I believe the best way to do this is to use data-driven testing with a datasource and datasource loop.  Please see the below documentation link on how to do data driven testing.

     

    http://readyapi.smartbear.com/soapui/data_driven/tutorial/intro/start

     

    If you can not use any external file or storage then a Groovy datasource may be the best datasource to use for this scenario.

     

    http://readyapi.smartbear.com/structure/sources/groovy/start

     

    Regards,

    Marcus

    SmartBear Support

    • dipit's avatar
      dipit
      New Contributor

      This is actually what I am trying to do

       

       

      So I am able to fetch the data from mysql db using jdbc request. I get the data and I process and store it as properties. So Property 1: h[0]=1,1&h[1]=2,2&h[2]=3,3& Property 2: h[0]=4,4&h[1]=5,5&h[2]=6,6& Property 3.. Property 4..

      These are the rest request config:

      Style: Query Level: Resource Value: I get data from the property using ${Properties#Property 1}

      Now I want to run the same rest request for all the properties

      So it should be like

      http://xxxxxxx/api/h[0]=1,1&...h[2]=3,3
      http://xxxxxxx/api/h[0]=4,4&...h[2]=6,6
      http://xxxxxxx/api/h[0]=7,7&...h[2]=9,9
      http://xxxxxxx/api/h[0]=10,101&...h[2]=12,12