jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <>
Subject Re: __XPath problems
Date Thu, 11 Feb 2010 23:09:02 GMT
On 11/02/2010, Sonam Chauhan <> wrote:
> Hello:
>  I've run into some problems with the __XPath function.  I use it as the 'Value' of a
HTTP sampler parameter:
>  -----------------------------------------------------
>  ${__XPath(prodcodes.xml, /root/code)}
>  -----------------------------------------------------
>  This obtains a product code from the prodcodes.xml file, whose content looks like this:
>  -----------------------------------------------------
>  <?xml version="1.0"?>
>  <root>
>  <code>00000123</code>
>  <code>00001234</code>
>  <code>00012345</code>
>  ...
>  </root>
>  -----------------------------------------------------
>  However, this __XPath function call always evaluates to value "null".
>  The jmeter.log simply notes the prodcodes.xml file being used, and then 'Stop Thread'
signal when the HTTP sampler fails due to "null" not being a product code:
>  -----------------------------------------------------
>  2010/02/12 08:42:03 INFO  - jmeter.functions.XPathWrapper: Integration Tests Thread
Group 1-1: Opening prodcodes.xml
>  2010/02/12 08:42:03 INFO  - jmeter.threads.JMeterThread: Stop Thread detected by thread
Integration Tests Thread Group 1-1
>  -----------------------------------------------------
>  Any thoughts on what could be wrong? Our setup uses JMeter 2.3.1 - I didn't see any
bugzilla entries for __XPath

No idea what the problem is, sorry.

However you could just use __StringFromFile() instead.

Or CSV Dataset - just ensure it is in the loop.

BTW, it's easy to test functions etc using Java Request - just put the
function call in the "Label" field and it will show up in the

Also, 2.3.1 is really old; there have been lots of bug fixes since then.

>  Regards,
>  Sonam Chauhan
>  PS: I use __XPath() because the HTTP sampler runs within a loop and it needs to use
a new product code in every iteration of the loop. CSV Data Set Config et al allocate one
config item per thread.
>  The information contained in this email and any attached files are strictly
>  private and confidential. This email should be read by the intended addressee
>  only. If the recipient of this message is not the intended addressee, please
>  call Corporate Express Australia Limited on +61 2 9335 0555 or Corporate Express
>  New Zealand Limited on +64 9 271 7600 and promptly delete this email and any
>  attachments. The intended recipient of this email may only use, reproduce,
>  disclose or distribute the information contained in this email and any attached
>  files with Corporate Express' permission. If you are not the intended addressee,
>  you are strictly prohibited from using, reproducing, disclosing or distributing
>  the information contained in this email and any attached files. Corporate
>  Express advises that this email and any attached files should be scanned to
>  detect viruses. Corporate Express accepts no liability for loss or damage
>  (whether caused by negligence or not) resulting from the use of any attached
>  files.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message