Skip to content

XPath2 Assertion

Configure the JMeter XPath2 Assertion assertions: properties, defaults, and practical usage notes for building reliable load tests.

Difficulty
intermediate
Guide type
reference
Estimated read time
1 min read
Last verified version
Verified JMeter 5.6

Part of the Assertions category. Also documented in context in the full Component Reference.

XPath2 Assertion

The XPath2 Assertion tests a document for well formedness. Using โ€œ/โ€ will match any well-formed document, and is the default XPath2 Expression. The assertion also supports boolean expressions, such as โ€œcount(//*error)=2โ€.

Some sample expressions:

  • //title[text()='Text to match'] - matches <title>Text to match</title> anywhere in the response
  • /title[text()='Text to match'] - matches <title>Text to match</title> at root level in the response
NameRequiredDescription
Namespaces aliases listNoList of namespaces aliases you want to use to parse the document, one line per declaration. You must specify them as follow: prefix=namespace. This implementation makes it easier to use namespaces than with the old XPathExtractor version.
XPath2 AssertionYesXPath to match in the document.
Invert assertionNoWill fail if xpath expression returns true or matches, succeed otherwise
Namespace aliases listNoList of namespace aliases prefix=full namespace (one per line)
On this page