Forum Discussion

chrisexv6's avatar
chrisexv6
New Contributor
10 years ago

Question about XPath Expression assertion

Im using an XPath Expression assertion to compare the response values from 2 webservices (old vs new)

Since the results should match exactly, I just made the XPath compare the whole response tree. But I have a question about what happens if it fails "early"

The response looks like this:
<NewDataSet xmlns="">
<Table diffgr:id="Table1" msdata&colon;rowOrder="0">
<Field1>2014-01-31T23:11:14.203-05:00</Field1>
<Field2></Field2>
<Field3></Field3>
<Field4></Field4>
</Table>
<Table diffgr:id="Table2" msdata&colon;rowOrder="1">
<Field1>2014-01-31T23:11:14.203-05:00</Field1>
<Field2></Field2>
<Field3></Field3>
<Field4></Field4>
</Table>

.....

</NewDataSet>

We're noticing there is a difference in return value for Field1 across the 2 webservices.

My question is - does processing of the assertion stop completely once it finds a difference? Or does it compare the whole response and show ALL differences? If Field3 has a difference, would the assertion show Field1 AND Field3 as not matching? (in the Assertion tab)

Thanks in advance.

-Chris

3 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    How are you doing currently? Are you asserting on the response, one assertion for field?
  • chrisexv6's avatar
    chrisexv6
    New Contributor
    nmrao wrote:
    How are you doing currently? Are you asserting on the response, one assertion for field?


    Currently just using one Xpath assertion and setting it so that it compares the complete NewDataset tag, which will encompass all of the tables (one table per record)

    I have a feeling it doesnt continue on once it hits that initial mismatch....Field1 is a date/time value. On the new webservice we are seeing below, on the old webservice the values match but not completely....there are trailing zeros added to the milliseconds. The assertion fails of course, but the log only shows the first table as the failure.

    To me that indicates it didnt continue onto the 2nd, 3rd, etc tables, but I wanted to be sure (since it looks like the for-sure way of doing this is springing for the Pro version to use and loop over Datasets)
  • nmrao's avatar
    nmrao
    Champion Level 3
    Are you a pro user? Please try posting in pro boards for faster resolution.
    In the free edition, you have to create an assertion for each check/validation , it will run all the assertions irrespective of any assertion failure.
    On the other hand if you have a script assertion, it will stop on the first error occurance.