Verify Response against Database

LegacyForumLegacyForum Posts: 1,669 ✭✭
edited December 2016 in SOAtest

Is there a way to take an element from a request and validate it against a database?

Input has Archive_id = 099999

I would like to take this value from the request and query the results from the response against the values in the database.

I am not sure how to go about this. I have read some threads about DB sources and chaining ... but I am not very familiar with chaining.

Any help is greatly appreciated.

- Sarah


  • LegacyForumLegacyForum Posts: 1,669 ✭✭
    Hi Sarah,

    Yes, to do this you would need to use tool chaining - here's how to do it:

    1) Right-click on the Messaging / SOAP Client that has the request element, and choose Add Output. In the dialog that opens, choose Request > Traffic (if Messaging Client) or Request > SOAP Envelope (if SOAP Client) on the left and XML Data Bank on the right. Click OK.
    2) Find and select the element that you want to save on the left, and click the Add XPath button. The element will be saved on the right. Note the Column Name. Save the editor.
    3) Add a DB Tool to your test, and configure it with the connection settings and SQL query to retrieve the desired data from your database (the data that you want to compare the request element against).
    4) Right-click on the DB Tool, and choose Add Output. In the dialog that opens, select XML Assertor on the right. The XML Assertor will be chained to the DB Tool. Note that the DB Tool returns the resultSet from the Database as XML, which the XML Assertor will use.
    5) Run the DB Tool. This will execute the query and populate the XML Assertor's Expected XML (data from the DB). You may need to close and re-open the XML Assertor's editor to see the Expected XML.
    6) In the XML Assertor's configuration tab, add a new Value Assertion. When adding the assertion, you will choose the element which corresponds to the value from the database that you retrieved (when choosing, it helps to switch back and forth between the Element view and Tree view).
    7) Now that the Value Assertion is created, set the expected value to Parameterized, and choose column name that you specified in step 2.
Sign In or Register to comment.