Forum Discussion

MRutten's avatar
MRutten
Occasional Contributor
3 years ago

REST Response: executing several teststeps for every object in REST response. How?

GOAL Execute several Test steps (GET requests) for every Object in a REST Query Response.   SCENARIO I want to build a Functional Test 1. Execute GET Query request that will have several results...
  • KarelHusa's avatar
    3 years ago

    MRutten ,

    using JSON DataSource might help here.

     

    An example for illustration (using famous Pet store use case from https://petstore3.swagger.io/ )

     

    How it works:

    1. GetPets: We get all pets with a GET query
    2. PetsDataSource: Parsing the GetPets response into a Data Source
    3. GetPetDetail: Using the value within a request
    4. Data Source Loop: Taking another set of values from Data Source and jump to GetPetDetail.

    There may be more complex processing between GetPetDetail and the end of the loop if needed.

    Here's the configuration of the Data Source:

     

     

    Best regards,

    Karel

     

  • giovanni_favara's avatar
    giovanni_favara
    3 years ago

    Daag meneer MRutten , ğŸ™‚

    ${loopCount} is wrong.
    Use ${#Properties#loopCount}.
    After ${# you must wirte the location, in your case the properties test step. On the end you write the name of the property. In your example is the name of the property #loopCount}.

     

    Best wishes, Giovanni