menyedi
13 years agoNew Contributor
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.
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.

