Forum Discussion

menyedi's avatar
menyedi
New Contributor
13 years ago

Need Advice on XPathContains Assertion / Data Driven

Hello,

I am new to SoapUI and I was hoping to get some advice on what I am trying to do. I am testing a REST service for an insurance calculator. The output is xml with a limited number of nodes. I was planning to use excel spreadsheets to data drive the Xpath queries as well as the expected results. My preference is to run all of the xpath queries even if the node doesn't exist. The problem with this approach is that the xpath query is returning an error. Is there a way to make that pass?

For example here is my xpath query:
declare namespace a='http://myproject.com/schema';
/a:Quote/a:AppliedRate/a:LineItems/a:LineItem
[a:Descriptors/a:Descriptor[a:Type = 'Product' and a:Name = 'Owner1']]
[a:Descriptors/a:Descriptor[a:Type = 'LineItemType' and a:Name = 'ProductBasePremium']]
/a:Amount/number()

My response doesn't contain a type = product and a name = Owner1 so it gives me an error: XPathContains assertion failed for Path.
If I could find a way to make that pass by passing some data through the spreadsheet, that would be great.

If not that, then I was hoping to find a way to look at my expected data and if it is blank to effectively skip running that XPathContains assertion.

Any advice would be great to get me moving in the right direction.

1 Reply

  • Hi,

    So, let me see if I've understood this correctly:

    You have two excel spreadsheets; one containing XPath queries and one containing expected data. Now, you want to run those XPath queries (to drive assertions), and you want to use them only when they are applicable to your expected data.

    Let me know if this is correct, and then we can look at it further.

    Welcome to SoapUI

    Regards,
    Arian
    SmartBear Sweden