Forum Discussion

Alex_Ben_Ari's avatar
13 years ago

XPath Assertions for JSON Response Fail on testrunner

Hi,

I'm Using SoapUi Pro v4.0.1.

I have tests against a REST API, which returns a JSON response.
The tests have XPath assertions for the response content. They were added automatically by the "Add Assertion" functionality on the Outline view, so the namespace declaration and xpath expression are not prone to typos or syntax problems.

When I run the test in the SoapUi GUI, they run perfectly.
However, when running them in testrunner, it seems like the JSON to XPath automatic conversion doesn't work, as the assertions fail with a message like:

XPathContains assertion failed for path [declare namespace ns1='XXX';
//ns1:Response[1]/YYY/text()] : Exception:Missing content for xpath [declare namespace ns1='XXX';
//ns1:Response[1]/YYY/text()] in Response

(The namespace XXX is not server specific.)

The response is logged to the error log as JSON and not XML.

"Contain" type assertions work properly, but they make the tests less accurate.

Can you please help me resolve this issue?

Thanks
No RepliesBe the first to reply