0
votes

XML response :

<silent><send-sss destination="*1234">TEST mId=dev oId=XXXXXXXXX</send-sms></silent>

JMeter response assertion: Pattern matching Rule: contains Pattern to test: silent

Failed Reason:

org.apache.oro.text.MalformedCachePatternException: Invalid expression: *1234
?+* follows nothing in expression

Could anyone please let me know what should be there is an assertion that it should fail. I tried using few patterns but it didn't work for me.

2

2 Answers

0
votes

In Response Assertion to find part of a string you need to choose Substring in Pattern Matching rules

Contains, Matches: Perl5-style regular expressions

Equals, Substring: plain text, case-sensitive

If you choose Contains (meaning regular expression) , you need to escape *, then use

\*1234
0
votes

For XML response types it makes more sense to go for XPath Assertion which allows checking response using arbitrary XPath queries.

If you want to test presence of <silent> tag only the relevant XPath query would be as simple as //silent.

With regards to Response Assertion, its Contains mode is PatternMatcher.contains() so it requires a regular expression, not a simple String so you should be using something like .*silent.* as the pattern.

See How to Use JMeter Assertions in Three Easy Steps article for more information on defining custom pass/fail criteria using JMeter Assertions.