Forum Discussion

robjahn's avatar
robjahn
Contributor
15 years ago

XPATH Tips

Couple general questions

1) what is syntax for putting what the XPATH assertion does into code?

for example from XPATH assertion that that matches the whole envelope to what put in a datasource.

declare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/';
//soapenv:Envelope[1]

${DataSource#o-xml#declare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/'; //soapenv:Envelope[1]}


2) related to #1, if the Result nodes come in different order that what might have expected, how best to do an script? (I did experiment with converting into arrays and using sort...but that is very cumbersome)

e.g.
expected: <statelist><state>A</state><state>B</state><state>C</state>
got : <statelist><state>A</state><state>C</state><state>B</state>

3) are there recommended approaches to validating the variable node results? For single node with fixed elements the out of box ways work ok, but I've seen in forums various approaches like
- putting many xpath or xquery asserstions for test case
- matching static XML file
- reading in assertions form some dataasource and adding them at run time

What seeking is a pattern that can be scalable to deal with many operations with minimal config in a given test case.
No RepliesBe the first to reply