0
votes

I've one simple jmeter login script for negative scenarios which takes invalid login and password.

It gives JSON response as { "status": 401, "error": "unauthorised", }

The above response is expected.

I've also added the JSON Path Assertion to verify the status code as 401 which validates correctly

Now my target is if I run the test it should pass however its coming as fail status. Sampler result shows as below

  Sample Count: 1
  Error Count: 1

How I can make it pass? Is it possible or not?

2
Is there any way we can call the org.apache.jmeter.visualizers.Sample and find getErrorCount() and make it to setErrorCount() as zero to make it pass status.asinha
got the answer. Used the response assertion and checked the ignore status checkboxasinha

2 Answers

0
votes

One more way is to add a BeanShell PostProcessor to that sample with prev.setResponseOK(); This will pass the previous sample irrespective of whatever result it got.

0
votes

You can try to add Response Assertion to your HTTP sampler and set check-box 'Ignore Status'. Then response will have status 403 and 'Error Count' equals to 0. Does it give result what you want?

Upd: Oops, author has already got the answer. Sorry