1
votes

On running jmeter script, I am getting Response code as [] How do I perform assert?

I tried Text response contains [] still jmeter could not pass and I got below message

Assertion failure message: Bad test configuration org.apache.oro.text.MalformedCachePatternException: Invalid expression: [] Unmatched [] in expression.

1

1 Answers

4
votes

It looks like you're using Response Assertion in "Contains" or "Matches" mode.

According to How to Use JMeter Assertions in Three Easy Steps guide:

The Pattern can be either be:

a “string” for “Equals” or “Substring” clauses

a “Perl5-style” Regular Expression for “Contains” or “Matches” clauses

So you need to:

  • either switch to "Equals" or "Substring" Pattern matching rule and keep your pattern as []
  • or if you using "Contains" or "Matches" rule - you need to remember that square brackets are special meta characters which represent character classes so they need to be escaped by forward slash like \[\]