Kindle Q
Kindle Q

Reputation: 944

jmeter HTTP Request get Path from XML element

I try to read XML elements in order to change the path of the HTTP Request of the performance test. My sample XML data

<test>
   <paths>
       <path>/?test=test1</path>
       <path>/?test=test2</path>
   </paths>
</test>

Here is the path that I tried to read it through BeanShell Sampler

enter image description here

Upvotes: 0

Views: 322

Answers (1)

Dmitri T
Dmitri T

Reputation: 168082

I would recommend using XPath Extractor for parsing XML data.

Demo:

JMeterXpath

Example queries:

  • //path - match both elements, you can use the output variables with ForEach Controller to hit all endpoints
  • //path[1] - matches only /?test=test1
  • //path[2] - matches only /?test=test2

See XPath Tutorial for more information on XPath syntax

Upvotes: 1

Related Questions