JMeter load testing – Regex problem solved

I've been having fun playing with JMeter to do some load testing on some of our applications recently and I came across this problem which had me stumped. Eventually my friendly sysadmins put me out of my misery. So to prevent other people from the same issues – here is the problem and the solution.

Jmeter screenshot - not working

JMeter is a great load testing application but it can be a bit tricky to when you are learning it.

For the particular testing I needed to get it to do the following:

  • Login in as a user
  • Retrieve the valid userid
  • Create a new test for the user
  • Get the testid back
  • Load the test details
  • Submit the test

I pretty quickly got everything working with some regex's to extract the userid and testid as required and my test case looked like the picture above.

Everything was working except the final submission of the test, which was failing as the regex variable was always using the default value, despite the fact that is was working for the previous step.

Jmeter screenshot - working!!

It turns out that the regex needed to be nested inside the request it was referring to or it would be called after every request, which in most cases would return the default value as the regex wouldn't match.

Once I put the regex's inside the requests the were not constantly being reset and everything worked a treat.

Hope it helps.


Related Content

This post was posted in , , , , , by on