Forum Discussion

JHoreczky's avatar
JHoreczky
Contributor
13 years ago

Combination of XML and Directory Datasources and Assertion

Thinking about using a combination of Directory and XML based DataSources combined with Assertion Steps for implementing response verification.

Set of canned SOAP responses reside in individual files in a specific directory. In the Assertion Step would need to read in the proper XML file matching the response that contains a saved version of the expected response. Use XPath for fetching elements both from the response and the expected response. Do assertion on the fetched values.

What API is available in Groovy for scripting XPath statements in the Assertion step? We cannot use generated static XPath assertions as the response is not entirely static in term of the number of elements returned, so we need to use some logic for dynamically constructing the XPath statements on the response in order to process the structurally different responses.

The approach described at http://blog.smartbear.com/software-qual ... -in-soapUI is useful, however it doesn't meet two critical pieces of our requirements:
1) The expected responses reside in individual XML files in a specific directory. 2) Structurally the XML document sent back in the response can vary in term of the elements it contains, thus the XPath assertions must be dynamically generated based on what elements are available in the response.


What would be the best option in SoapUI for implementing the above?

Thanks,
Joseph H.
  • After reading: http://blog.smartbear.com/software-qual ... soapUI-4-5

    I believe 'Message content assertion' could be used, but augmented by reading the 'snapshot responses' from files for each response, as opposed to reconfigure the assertion for the differing responses when running the test. We do data driven testing, thus when the test runs the request data is based on an Excel datasource, one line for each request. The responses do differ in most cases, so we need to create the 'Message content assertions' dynamically too.

    Still need some advice about the best possible approach for implementing this in SoapUI.


    Thanks,

    Joseph H.
  • I came up with a solution by searching the postings and using ideas based on the solution fragments I found.