Discussion:
Question on how to use Xpath in response of a request
Mathijs Groen
2018-12-03 16:22:26 UTC
Permalink
I perform a http request which results in a response containing a large xml file.

Now, I want to find a specific value for a specific tag. Example “parameter1” should have value “123”

Can I use Jmeter XPath Assertion for that? And how to implement this?

(I am pretty new to Jmeter).

Thanks,
Mathijs
Bruno Antunes
2018-12-03 16:53:54 UTC
Permalink
If you want to extract some value on response, you should probably use a
Post Processor

Post-Processors (
https://jmeter.apache.org/usermanual/component_reference.html#postprocessors):
As the name suggests, Post-Processors are applied after samplers. Note that
they are applied to all the samplers in the same scope, so to ensure that a
post-processor is applied only to a particular sampler, add it as a child
of the sampler.

XPath Extractor:
https://jmeter.apache.org/usermanual/component_reference.html#XPath_Extractor

XPath2 Extractor:
https://jmeter.apache.org/usermanual/component_reference.html#XPath2_Extractor

If you want to "assert" that response as some data, you can use an Assertion

Assertions (
https://jmeter.apache.org/usermanual/component_reference.html#assertions) :
Assertions are used to perform additional checks on samplers, and are
processed after every sampler in the same scope. To ensure that an
Assertion is applied only to a particular sampler, add it as a child of the
sampler.

XPath Assertion:
https://jmeter.apache.org/usermanual/component_reference.html#XPath_Assertion

Other Articles that can help:

Using the XPath Extractor in JMeter
https://www.blazemeter.com/blog/using-xpath-extractor-jmeter-0

How to Use JMeter Assertions in Three Easy Steps
https://www.blazemeter.com/blog/how-use-jmeter-assertions-three-easy-steps
--
Bruno Antunes
Java Software Engineer
Post by Mathijs Groen
I perform a http request which results in a response containing a large xml file.
Now, I want to find a specific value for a specific tag. Example
“parameter1” should have value “123”
Can I use Jmeter XPath Assertion for that? And how to implement this?
(I am pretty new to Jmeter).
Thanks,
Mathijs
Loading...