Problems with xpath matching

Getting some XML back from a GET

Basically:


xxx

Please, don’t blame me for the messed up namespace on productid, not my XML.

However if I do

check((xpath("//*").saveAs(“stuff”))

it gives me an error when it does the implicit exists

However it should work fine. That xpath (not the one I want but I just want to get SOMETHING to work) works fine in Oxygen in XPath 1.0 and 2.0 modes.
As its so permissive.

Now, I can save the xml, e.g.

bodyString.saveAs(“returned_xml”)

And can even print out as debug later on via exec(session=>session)

How would I write my own check predicate? i.e. take xml string, perform various of my own xpath tests, emit an error to gatling if I’m not happy.

Thanks.

Dino.

Oh yes, using the latest Gatling 2.0.0.20130628

Gatling uses plain Java Xerces’ XPath, no custom stuff here.

Could you please provide a XML sample and XPath expression that look like your real world use case?
You can try an online XPath tester such as this one: http://www.freeformatter.com/xpath-tester.html

Also note that if you have namespaces in your XML, you have to pass them explicitly and also use them in your expression, like in the second sample here:
https://github.com/excilys/gatling/wiki/Checks#wiki-xpath

Also note that you’re using an old timestamped version (June, 28) while M3a has been released on July, 10. You’d better upgrade.

Cheers,

Stéphane

Works now that I’ve upgraded to 2.0.0.M3a

Did a .check(xpath("//organisation-id").saveAs(“organisation-id”)) , works lovely.

Dino.

Great news!