---
title: "XPath2 Assertion"
description: "Configure the JMeter XPath2 Assertion assertions: properties, defaults, and practical usage notes for building reliable load tests."
url: https://docs.jmeter.ai/components/xpath2-assertion/
lastUpdated: 2026-10-01
source: docs.jmeter.ai
---

# XPath2 Assertion

*Part of the **Assertions** category. Also documented in context in the [full Component Reference](/user-manual/component-reference/#xpath2-assertion).*

![XPath2 Assertion](/images/screenshots/xpath_assertion.png)

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 `&lt;title&gt;Text to match&lt;/title&gt;` anywhere in the response
- `/title[text()='Text to match']` - matches `&lt;title&gt;Text to match&lt;/title&gt;` at root level in the response

| Name | Required | Description |
| --- | --- | --- |
| Namespaces aliases list | No | List 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 Assertion | Yes | XPath to match in the document. |
| Invert assertion | No | Will fail if xpath expression returns true or matches, succeed otherwise |
| Namespace aliases list | No | List of namespace aliases prefix=full namespace (one per line) |

## Related

- [Assertions & SLA Validation](/topics/jmeter-assertions-guide/)
- [Full Component Reference](/user-manual/component-reference/)
- [Functions and Variables](/user-manual/functions/)
