Forum Discussion

HaroldR's avatar
HaroldR
Contributor
7 years ago

How Message content assertion operate

Hello all,

As part of a migration, I should test the equity of the responses received by both version of a web service. Both version attack two differents back-end. My test should passed only if the responses are uniforms.

As some inputs are variants (i.e IDs) from a version to another, I made a complex message content assertion. Thereby, I can set some tags in response of V1 to be equal to the corresponding tags in the response of V2, and for the values which are differents, I can also set the values inside the tags to be different from the V1 to V2. Doing that permit me to achieve my purpose.
 
However, I am wondering with which data the assertion is compared if I do not specify expected values in the assertion.
Does the assertion really compare tag value from V1 response to the corresponding tag value of V2 response? The assertion is only set in the test step where I add V2 Request.
What happens in comparison when some tags are added inside other tags of V2, and these tags are not present in V1... My test is in success but, according to me, should not be?
Sp finally my subject is to understand better how the complex message content assertion works to meet my need?

Regards

3 Replies

  • Hello,

     

    The assertion doesn't compare the Expected and Actual result of an element unless you enable the condition for this element:

     

     

    So, from your description, it looks like your assertion does nothing (no conditions are enabled).   

     

    To compare two responses, your assertion added to the second request should look like this:

    • HaroldR's avatar
      HaroldR
      Contributor

      Thanks for answering to my question. That's a nice explaination of how the function operates.

      However, I did understand how the assertion works by using it. 

      Finaly, I have found that my purpose was not very explicit to suit my need. I want to automate comparison between 2 responses. I have to compare each node value of  2 responses.

      Basically, there are multiple nodes which have the same value and other nodes which are variant. 
      Both responses are very verbose and contain at least 5000 xml lines. I can achieve this purpose with the message assertion fucntion. But when the responses are as wide as these one, it's struggle and painful to check all checkboxes from the response. So my subject is how to avoid wasting time doing automation to get all tags values and compare them two to two.
       
      I'm new to ready api, so it's not obvious how to do this. I read multiple subjects about responses comparison but I'm not sure where to begin and what should I do to achieve this purpose. Any suggestion!?

      • groovyguy's avatar
        groovyguy
        Champion Level 1

        If you have that much data to compare, writing a custom groovy script may be another option.