Reputation: 11
I am using ResultCollector to save the response data to XML, and parsing the XML file to get the required data. The requirement actually is to get the responsedata without writing it to XML. I have searched and I have found results saying to use beanshell sampler. I even searched about using beanshell sampler. I am not clear on how to use beanshell sampler to extract the desired data without saving to XML. I am trying to use only the java code to create .jmx script. Not interested in using JMeter UI.
can anyone help me out. Thanks in advance.
Upvotes: 0
Views: 149
Reputation: 168072
Check out XPath Extractor which is designed to extract "interesting" values from XML, XHTML and HTML responses using XPath query language, this way you will be able to skip this "save response data to XML" interim step.
You can add it to your Test Plan programmatically, you will need to properly instantiate and configure org.apache.jmeter.extractor.XPathExtractor class.
Check out Using the XPath Extractor in JMeter guide to learn more about correlation of XML data with XPath concept.
Upvotes: 1