raql18
raql18

Reputation: 1

How to run JMeter failed threads after test stops?

I'm using JMeter to run a functional test to update the password of a lot of users (22K). I've separated the users in 2 scripts and used a Ultimate Thread Group with Start Threads Count = 100, which is the value with which I got less errors, however I still got 1.5% transactions failed, and I need to rerun only this failed threads, because all users need to have the same password. I've tried to get answers to this specific problems, but I have only found ways to prevent this from happening, like using a While controller with a timer, or logging the full response for failure, but I haven't found if there is a way to specifically rerun the failed threads. Does anyone know if this is possible?

Upvotes: 0

Views: 822

Answers (2)

AA Ron
AA Ron

Reputation: 484

Another approach to solving the problem would be to anticipate errors on some of the password update calls and build a data file upon failure with the information you need.

For Example:

Create a regular expression post processor that has default value of false, and template value of true. Make the expression match the expected response, and fail if the sample fails.

Then, after that sampler, you can add an if statement based on the new true/false variable. If it is false, you know the previous password update failed. Inside the if statement, add a dummy sampler with response data containing all the information you need to know which accounts you must retry.

Then, add a simple file writer to this dummy sampler, and log the dummy sampler response data to a file. At the end of a test run this data file would contain all the information you need to re-try all failed accounts.

Sadly this is a slightly manual process, but I'm sure with a little creativity you could automate recursive test runs until the re-try file is empty. Beanshell file IO might let you handle it all inside a single test run.

-Addled

Upvotes: 0

Manish Sapariya
Manish Sapariya

Reputation: 3605

You will have to do following.

  • Use JSR223 sampler to set the rescode=0
  • While controller with (if rescode!=200)
    • HTTP Sampler
      • JSR223 post processor as javascript as the scripting language.
      • Store response code using prev.getResponseCode()
        • e.g. vars.put("rescode", prev.getResponseCode());

You might have to add some more intelligence to the script to avoid infinite loop.

Upvotes: 0

Related Questions