3

I have a thread group with a login part and a part that checks different webpages. I want the thread group to loop forever, since its used for monitoring. However I want to start the next loop when an error occurs on the login part of the thread, but I want the thread to continue when an error occurs on one of the webpages. I have tried to do this using jsr223 postprocessors/samplers/listeners with the following code:

Boolean result = sampleResult.isSuccessful();

if ( result == false){
    sampleResult.setStartNextThreadLoop(true);
}

I've also tried this using if controllers/while controllers but I cant figure out how I can accomplish this.

Can anyone help me out?

Tinuva
  • 33
  • 2
  • 5

1 Answers1

3

I have dealt with this before.

In your post processor you can set a variable based on success as you show in your code. I made mine a String instead of a Boolean due to some issues I had with the if controller.

     Boolean result = sampleResult.isSuccessful();
   vars.put("success", result.toString())

After the sampler you have the post processor on place an If controller. The condition should be:

"${__javaScript("${success}"=="false")}"

Put a test action as the child of the If controller and select "Go to next loop iteration" as the action.

Finally, set the thread group to continue on error.

JusMe
  • 278
  • 1
  • 7
  • Thanks! It works now! I just needed to use prev.isSuccesful instead of sampleResult.isSuccesful – Tinuva Sep 14 '15 at 08:20