Search code examples
jmeterperformance-testingassertionjmeter-5.0

Jmeter response assertion is failing


I have one API request in which on success i get below tag in its response:

<TktNum xmlns=\"\">12012</TktNum>

And i have response assertion set as Text Response and pattern rule as Contains with text as mentioned below:

<TktNum xmlns=\"\">

enter image description here

But, Jmeter is failing this assertion even for success.

how can i get this to work?

Thanks.


Solution

  • As per How to Use JMeter Assertions in Three Easy Steps article

    The most commonly used assertion is the Response Assertion, which checks whether a response text/body/code/message/header contains, matches, or equals a specified pattern.

    The Pattern can be either be:

    • a “string” for “Equals” or “Substring” clauses
    • a “Perl5-style” Regular Expression for “Contains” or “Matches” clauses

    So I believe you need to amend your expression to something like:

    <TktNum xmlns=\\"\\">(\d+)</TktNum>
    

    More information: