Forum Discussion

Kate1's avatar
Kate1
New Contributor
7 years ago

Change dynamic variable in loop Rest SoapUI

Hi! I can't dynamic change variable in URL. I have URL for example: https://community.smartbear.com/t5/1234?action=update?status=acive and I would like change dynamic in loop paramter '1234'. For ex...
  • bagochips's avatar
    bagochips
    7 years ago

    Add a groovy step with something like this. In your REST step parameter reference the id number like this ${#TestCase#id}. For each loop a new id will be created for the request. There are many ways to achieve this same thing.

     

    def i = 1

    while (i < 8){
    String id = i
    context.testCase.setPropertyValue("id", id)
    testRunner.runTestStepByName( "REST_REQUEST") //disable your REST_REQUEST step and let the groovy script drive the execution
    i++
    }