Assert returns HTTP 400 status code as success

I have been using JMeter for a while and only for load tests. I was wondering if I can use it for routine functionality testing.

For example: I have invalid XML and the application returns 400 Bad Request , which I expect will be returned, so it is fixed, but JMeter resolves it as a failure.

I tried Response Assertions, but that didn't work ...

Is this possible with JMeter?

+6
source share
2 answers

Easy.
See Answers.

You can also try NOT check-box in Pattern matching rules. Answer the question.

+4
source

To test the response code not 200, you must check the "Ignore status" field in the response statement. Without this, the test will always fail, regardless of the approval of the answer.

So here is what you need to do to check the HTTP 400 response code:

Add a new response confirmation. Set the following statement properties:

  • set the "Answer Code" radio button.
  • check the "Ignore status" box.
  • check the Equal to box in the Template Matching Rules.
  • Click the Add button.
  • enter "400" in the line under "Test Patterns".

Done.

+27
source

Source: https://habr.com/ru/post/913152/


All Articles