One of the projects I am currently working on involves re-writing a REST service written in ColdFusion into Java/Spring. I’m in the testing phase, and am trying to make sure the endpoints behave the same as the ColdFusion versions.

One of the tests I am performing is to replay a month’s worth of GET requests from production against this service, and look for differences in the output. I also want to highlight any that have an unknown status code. It is possible for this service to return a 200/OK or 404/NOT_FOUND, anything else indicates an error.

I’m using JMeter to run this test, and it will report any response code of 400 or higher as an error, so I needed to find a way to change that. There are a few options, but the simplest I could find was the following:

  1. Create a Response Assertion, either at the same level or as a child of the HTTP request
  2. Test the Response Code field
  3. Check Ignore Status
  4. Pattern Matching: Matches
  5. Add a regular expression of the status codes you want to test against, in this case, 200|404

responseAssertion200404