tags:

views:

369

answers:

2

Hi, i'm currently using SoapUI Free edition 3.2-beta 2. And i have a weird problem with a Xpath assertion:

I have this in response:

(...) And i'm using this xpath to assert that the "niveau" with id='2' is in the response:

Xpath expression; //*:niveau[@id='2']

& the expected result is :

but i have this error message: XPathContains comparison failed, expecting [ ], actual was [null]

but if i try this : exitsts(//*:niveau[@id='2']) & the expected result is : True it works !!?

But this syntax is quite difficult to read & lmaintain & i would like to use the 1st syntax (i ve tried to ignore namespace, add them.. stil doesnt work).

Any idea ?

Regards

+1  A: 

The XPath that you declare is actually run against the XML in the response. Then it compares it against the text in "Expected Result".

I'm not 100% sure what you're trying to do. Given this response:

<root>
  <a>
    <b id="2" />
  </a>
  <c>
  </c>
</root>

If you put this in the "Declare": //b[@id=2], it will run that XPath against the XML. That XPath (untested) should select just the <b> element.

Then your "Expected Result" should be: <b id="2" />.

Nick Spacek
A: 

Give the pro version trial a spin, and you'll see that it's got a nice xpath expert built-in. With a sample request present, you can just pick the value that you're looking for and it'll generate the xpath and show you the value. Very cool. Copy/paste the xpath back into the free version and you're all set. Or, if you're like me, push harder for your boss to buy the Pro version for you.

Chris Thornton