3

I am quite new to jmeter, I am using it to load test an application. My current setup is good if running few threads at a time but gets problems when more users get connected.

Here's the scenario,

sample_1: request table data
sample_2: set table row with empty user column as used by current user
    |
    '-->post_process_beanshell: check if have error message
sample_3: do other stuff

Currently I am able to check if the 2nd sample has an error message, the question is how do I tell beanshell to go back to 1st sample when the 2nd sample has an error message?

Dominick Navarro
  • 752
  • 6
  • 20

2 Answers2

2

I would recommend put your "sample_3" under If Controller like:

  • Loop Controller (define maximum number of n-tries)
    • sample_1
    • sample_2
      • post_process_beanshell
    • If Controller: condition ${JMeterThread.last_sample_ok}
      • sample_3

JMeterThread.last_sample_ok - is a pre-defined variable which returns "true" if previous sampler was successful and "false" if not so if your "sample_2" will fail - "sample_3" won't be executed and the whole sequence will start over

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
1

Assuming you want to keep going back to sampler1 until sampler2 beanshell returns true, use a While controller.

Stick both sampler1 and sampler2 in a while controller which is conditional on the result of your error check.

RaGe
  • 22,696
  • 11
  • 72
  • 104