Class XPath

java.lang.Object
org.apache.jmeter.functions.AbstractFunction
org.apache.jmeter.functions.XPath
All Implemented Interfaces:
org.apache.jmeter.functions.Function

@AutoService(org.apache.jmeter.functions.Function.class) public class XPath extends org.apache.jmeter.functions.AbstractFunction
The function represented by this class allows data to be read from XML files.

Syntax is similar to the CVSRead function. The function allows the test to line-thru the nodes in the XML file - one node per each test, e.g. inserting the following in the test scripts:


 ${_XPath(c:/BOF/abcd.xml,/xpath/)} // match the (first) node
 ${_XPath(c:/BOF/abcd.xml,/xpath/)} // Go to next match of '/xpath/' expression
 
NOTE: A single instance of each different file/expression combination is opened and used for all threads.
Since:
2.0.3
  • Constructor Details

    • XPath

      public XPath()
  • Method Details

    • execute

      public String execute(org.apache.jmeter.samplers.SampleResult previousResult, org.apache.jmeter.samplers.Sampler currentSampler) throws org.apache.jmeter.functions.InvalidVariableException
      Specified by:
      execute in interface org.apache.jmeter.functions.Function
      Specified by:
      execute in class org.apache.jmeter.functions.AbstractFunction
      Throws:
      org.apache.jmeter.functions.InvalidVariableException
    • getArgumentDesc

      public List<String> getArgumentDesc()
    • getReferenceKey

      public String getReferenceKey()
      Specified by:
      getReferenceKey in interface org.apache.jmeter.functions.Function
      Specified by:
      getReferenceKey in class org.apache.jmeter.functions.AbstractFunction
    • setParameters

      public void setParameters(Collection<org.apache.jmeter.engine.util.CompoundVariable> parameters) throws org.apache.jmeter.functions.InvalidVariableException
      Specified by:
      setParameters in interface org.apache.jmeter.functions.Function
      Specified by:
      setParameters in class org.apache.jmeter.functions.AbstractFunction
      Throws:
      org.apache.jmeter.functions.InvalidVariableException