Anonymous
Anonymous

Reputation: 888

How to show expected error as pass in jmeter

Response message in View results in a tree is "xyz abc".

We would like to accept this error as pass. I tried "Ignore status" check but that doesnot work in assertion.

Upvotes: 1

Views: 1302

Answers (1)

Dmitri T
Dmitri T

Reputation: 168157

JMeter automatically treats Response Status Codes >= 400 as not successful. Ignore Status box of the Response Assertion should suppress this check.

If you want JMeter to mark Sampler with **Response Messagexyz abc` as successful you can add JSR223 Assertion as a child of this Sampler and put the following code into "Script" area:

if (prev.getResponseMessage().equals('xyz abc')) {
    prev.setSuccessful(true)
}

Check out Scripting JMeter Assertions in Groovy - A Tutorial article for more information on defining custom pass/fail criteria using Groovy language

Upvotes: 3

Related Questions