Forum Discussion

DDS_Inc__Suppor's avatar
DDS_Inc__Suppor
Occasional Contributor
14 years ago

Compare response msg to JDBC result set

Can you please tell me the best way to compare a response message with a JDBC result set? There are several repeating nodes that need to be compared. There is really no way to order the SQL for the JDBC results to guarantee the results match the response message order.
Response
<Response>
<e>
<estimateCode>003</estimateCode>
<estimateEndDate>12/30/2012</estimateEndDate>
<estimateName>2012</estimateName>
<estimateStartDate>12/31/2011</estimateStartDate>
<id>1232662</id>
</e>
<e>
<estimateCode>001</estimateCode>
<estimateEndDate>12/30/2011</estimateEndDate>
<estimateName>2011 YEAR</estimateName>
<estimateStartDate>12/31/2010</estimateStartDate>
<id>1248552</id>
</e>
<e>
<estimateCode>002</estimateCode>
<estimateEndDate>05/31/2012</estimateEndDate>
<estimateName>CROSSOVER</estimateName>
<estimateStartDate>06/01/2011</estimateStartDate>
<id>1248858</id>
</e>
</Response>

JDBC Results
<Results>
<ResultSet fetchSize="10">
<Row rowNumber="1">
<CODE>003</CODE>
<END_DATE>12/31/2012</END_DATE>
<NAME>2012</NAME>
<START_DATE>01/01/2012</START_DATE>
<ID>1232662</ID>
</Row>
<Row rowNumber="2">
<CODE>002</CODE>
<END_DATE>05/31/2012</END_DATE>
<NAME>CROSSOVER</NAME>
<START_DATE>06/01/2011</START_DATE>
<ID>1248858</ID>
</Row>
<Row rowNumber="3">
<CODE>001</CODE>
<END_DATE>12/31/2011</END_DATE>
<NAME>2011 YEAR</NAME>
<START_DATE>01/01/2011</START_DATE>
<ID>1248552</ID>
</Row>
</ResultSet>
</Results>
  • Finan's avatar
    Finan
    Frequent Contributor
    Easiest way is to:
    1. First execute the JDBC request (if possible)
    2. Then execute the soap-request
    3. add xpath-match assertions to the soap-request

    when adding an xpath-match assertion:
    1. first declare the content of the response to validate (i.e. estimatecode)
    2. Then use the select content button to select the node on the JDBC result set to validate (i.e. estimatecode)

    repeat this for the individual nodes, et voila.
  • DDS_Inc__Suppor's avatar
    DDS_Inc__Suppor
    Occasional Contributor
    Thanks for the reply.

    So this method will verify all sets of data returned by both the sql query and the response msg regardless of the number of data sets returned (3, 4, 5, etc)?
  • Finan's avatar
    Finan
    Frequent Contributor
    sorry, missed that part of the post
    I'm not entirely sure what you mean with that.

    Is is the JDBC or the soap response that contains multiple sets of data, or do you want to perform the validation for multiple cases?
  • DDS_Inc__Suppor's avatar
    DDS_Inc__Suppor
    Occasional Contributor
    No problem.

    The response message will have multiple sets of data in it. The sql query will return the same number of corresponding rows of data back. I want to make sure the all the data in the response message matches the data returned by the query.