org.apache.jmeter.assertions

## Class XPath2Assertion

- java.lang.Object
- - org.apache.jmeter.testelement.AbstractTestElement
  - - org.apache.jmeter.testelement.AbstractScopedTestElement
    - - org.apache.jmeter.testelement.AbstractScopedAssertion
      - - org.apache.jmeter.assertions.XPath2Assertion

- All Implemented Interfaces:
    Serializable, Cloneable, Assertion, Searchable, TestElement

      public class XPath2Assertion
      extends AbstractScopedAssertion
      implements Serializable, Assertion

  Checks if the result is a well-formed XML content and whether it matches an XPath
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_XPATH`

    - ### Fields inherited from interface org.apache.jmeter.testelement.TestElement

      `COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `XPath2Assertion()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getNamespaces()`
    `AssertionResult` | `getResult(SampleResult response)` Returns the result of the Assertion.
    `String` | `getXPathString()` Get The XPath String that will be used in matching the document
    `boolean` | `isNegated()` Negate the XPath test, that is return true if something is not found.
    `void` | `setNamespaces(String namespaces)`
    `void` | `setNegated(boolean negate)`
    `void` | `setXPathString(String xpath)` Set the XPath String this will be used as an xpath

    - ### Methods inherited from class org.apache.jmeter.testelement.AbstractScopedAssertion

      `getScopeName`

    - ### Methods inherited from class org.apache.jmeter.testelement.AbstractScopedTestElement

      `fetchScope, getSampleList, getVariableName, isScopeAll, isScopeChildren, isScopeParent, isScopeVariable, isScopeVariable, setScopeAll, setScopeChildren, setScopeParent, setScopeVariable`

    - ### Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement

      `addPropertiesValues, addProperty, addProperty, addTestElement, canRemove, clear, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.jmeter.testelement.TestElement

      `removed`

- - ### Field Detail

    - #### DEFAULT_XPATH

          public static final String DEFAULT_XPATH

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### XPath2Assertion

          public XPath2Assertion()

  - ### Method Detail

    - #### getResult

          public AssertionResult getResult(SampleResult response)

      Returns the result of the Assertion. Checks if the result is well-formed XML, and that the XPath expression is matched (or not, as the case may be)
      Specified by:
        `getResult` in interface `Assertion`
      Parameters:
        `response` - the SampleResult containing information about the Sample (duration, success, etc)
      Returns:
        the AssertionResult containing the information about whether the assertion passed or failed.

    - #### getXPathString

          public String getXPathString()

      Get The XPath String that will be used in matching the document
      Returns:
        String xpath String

    - #### setXPathString

          public void setXPathString(String xpath)

      Set the XPath String this will be used as an xpath
      Parameters:
        `xpath` - String

    - #### setNegated

          public void setNegated(boolean negate)

    - #### isNegated

          public boolean isNegated()

      Negate the XPath test, that is return true if something is not found.
      Returns:
        boolean negated

    - #### setNamespaces

          public void setNamespaces(String namespaces)

    - #### getNamespaces

          public String getNamespaces()

Copyright © 1998-2022 Apache Software Foundation. All Rights Reserved.