Forum Discussion

swprabhu's avatar
swprabhu
Occasional Contributor
8 years ago

Validate repeated response elements

In My response, the field security information comes multiple times and under each security information , there are a set of fields which repeat. How do I assert these values against a REST response

 

eg : My SOAP response is something like below. The number of securities and taxlots for each security vary based on the input account number. The value of each response field should be validated again a REST response .  The format of the REST RESPONSE is also almost similar. I cannot use Xpath as the number of securities and taxlots can be 1000 in number or more. Also I cannot define each using context.expand for the same reason. Is there any way to validate this

 

Security 1

     TaxlotList 1
            Name 1
            Address 1

 

      TaxlotList 2
            Name 2

            Address 1


Security 2

       TaxlotList 1
            Name 1
          Address 1

 

         TaxlotList 2
             Name 2
          Address 2

 

Security 3

       TaxlotList 1
             Name 1
          Address 1

 

  • Hi,

     

    If you need to compare the full response from SOAP service with a full response from your REST service, then you can save a one response to a custom testcase property for example and then use the Equals assertion to compare with the current response value. Also, you can use the Script assertion.