Jmeter - Break a loop once the condition is met
up vote
1
down vote
favorite
In my thread I get active_status
parameter from Cassandra DataBase. I need to run on each active_status var been created from Cassandra sample (active_status_1, active_status_2, etc..) and check if it's active
.
When not active it should skip and do nothing and if it's active
I need to do an action only once and then stop (so even if I have 10 active
results, it will perform the action ("report" in my case) only on the first one).
active_status vars from debug response
media_id vars from debug response
http request where I use the counter
My action (report) request is: story_id=evE0-001-085121182-5&media_id=1021372295263777595_175887011&who=admin&reason=offensive&blogger_id=Amit
even though "1021372295263777595_175887011" is not ACTIVE
jmeter
add a comment |
up vote
1
down vote
favorite
In my thread I get active_status
parameter from Cassandra DataBase. I need to run on each active_status var been created from Cassandra sample (active_status_1, active_status_2, etc..) and check if it's active
.
When not active it should skip and do nothing and if it's active
I need to do an action only once and then stop (so even if I have 10 active
results, it will perform the action ("report" in my case) only on the first one).
active_status vars from debug response
media_id vars from debug response
http request where I use the counter
My action (report) request is: story_id=evE0-001-085121182-5&media_id=1021372295263777595_175887011&who=admin&reason=offensive&blogger_id=Amit
even though "1021372295263777595_175887011" is not ACTIVE
jmeter
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
In my thread I get active_status
parameter from Cassandra DataBase. I need to run on each active_status var been created from Cassandra sample (active_status_1, active_status_2, etc..) and check if it's active
.
When not active it should skip and do nothing and if it's active
I need to do an action only once and then stop (so even if I have 10 active
results, it will perform the action ("report" in my case) only on the first one).
active_status vars from debug response
media_id vars from debug response
http request where I use the counter
My action (report) request is: story_id=evE0-001-085121182-5&media_id=1021372295263777595_175887011&who=admin&reason=offensive&blogger_id=Amit
even though "1021372295263777595_175887011" is not ACTIVE
jmeter
In my thread I get active_status
parameter from Cassandra DataBase. I need to run on each active_status var been created from Cassandra sample (active_status_1, active_status_2, etc..) and check if it's active
.
When not active it should skip and do nothing and if it's active
I need to do an action only once and then stop (so even if I have 10 active
results, it will perform the action ("report" in my case) only on the first one).
active_status vars from debug response
media_id vars from debug response
http request where I use the counter
My action (report) request is: story_id=evE0-001-085121182-5&media_id=1021372295263777595_175887011&who=admin&reason=offensive&blogger_id=Amit
even though "1021372295263777595_175887011" is not ACTIVE
jmeter
jmeter
edited Jul 12 '15 at 10:51
asked Jul 9 '15 at 10:42
Amit Ronen
69213
69213
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
Use :
User Parameters PreProcessor once as a child of a Sampler before the ForEach Controller to init RUN_ONCE to false:
and once as a child of the HTTP Request that runs on active status to set RUN_ONCE to true
ForEach Controller with following settings:
If Controller and put in condition:
${__jexl2( "${status}" == "ACTIVE" && "${RUN_ONCE}" == "false")}
- Test Plan would look like this:
You counter should be in ForEachController not in If Controller as it will not increment correctly and give the ID for the correct status
Where should I put the counter? I've tried this code in While: ${__jexl2( "${active_status${counter}}" == "ACTIVE" && "${counter}" < 1 )}. and put the counter under the while controller (starts with "0" and increments by 1). But it's not getting inside the while..
– Amit Ronen
Jul 12 '15 at 6:33
I managed to solve this one. The problem was with the quotes on "counter" var. So it's getting into the while controller but stops only after "counter" 1, even though the first two "active_status" are not active so it should continue to the next one
– Amit Ronen
Jul 12 '15 at 6:49
But in that case, won't it just run on all "active_status"? If if get it right, with this option, it will run on all "active_status_(number)" and make the report action on all of them which are active. I don't need to report more than once. So to explain again: Run on active_status_1 -> if active -> report and stop the loop. Only if not active -> skip to active_status_2 -> if active - > report and stop
– Amit Ronen
Jul 12 '15 at 9:02
I updated my post with screenshot trying your solution. The action (report) is done on a media which is not active .(INACTIVE_FORCED_ADMIN in this case).
– Amit Ronen
Jul 12 '15 at 9:59
Added requested screenshots
– Amit Ronen
Jul 12 '15 at 10:14
|
show 3 more comments
up vote
0
down vote
You can use 'while controller' with a condition:
${__javaScript( "${some_var}" = "something" && "${some_other_var}" < "${something_else}"; )}
One of those expressions should refer to counter, another to status.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Use :
User Parameters PreProcessor once as a child of a Sampler before the ForEach Controller to init RUN_ONCE to false:
and once as a child of the HTTP Request that runs on active status to set RUN_ONCE to true
ForEach Controller with following settings:
If Controller and put in condition:
${__jexl2( "${status}" == "ACTIVE" && "${RUN_ONCE}" == "false")}
- Test Plan would look like this:
You counter should be in ForEachController not in If Controller as it will not increment correctly and give the ID for the correct status
Where should I put the counter? I've tried this code in While: ${__jexl2( "${active_status${counter}}" == "ACTIVE" && "${counter}" < 1 )}. and put the counter under the while controller (starts with "0" and increments by 1). But it's not getting inside the while..
– Amit Ronen
Jul 12 '15 at 6:33
I managed to solve this one. The problem was with the quotes on "counter" var. So it's getting into the while controller but stops only after "counter" 1, even though the first two "active_status" are not active so it should continue to the next one
– Amit Ronen
Jul 12 '15 at 6:49
But in that case, won't it just run on all "active_status"? If if get it right, with this option, it will run on all "active_status_(number)" and make the report action on all of them which are active. I don't need to report more than once. So to explain again: Run on active_status_1 -> if active -> report and stop the loop. Only if not active -> skip to active_status_2 -> if active - > report and stop
– Amit Ronen
Jul 12 '15 at 9:02
I updated my post with screenshot trying your solution. The action (report) is done on a media which is not active .(INACTIVE_FORCED_ADMIN in this case).
– Amit Ronen
Jul 12 '15 at 9:59
Added requested screenshots
– Amit Ronen
Jul 12 '15 at 10:14
|
show 3 more comments
up vote
1
down vote
accepted
Use :
User Parameters PreProcessor once as a child of a Sampler before the ForEach Controller to init RUN_ONCE to false:
and once as a child of the HTTP Request that runs on active status to set RUN_ONCE to true
ForEach Controller with following settings:
If Controller and put in condition:
${__jexl2( "${status}" == "ACTIVE" && "${RUN_ONCE}" == "false")}
- Test Plan would look like this:
You counter should be in ForEachController not in If Controller as it will not increment correctly and give the ID for the correct status
Where should I put the counter? I've tried this code in While: ${__jexl2( "${active_status${counter}}" == "ACTIVE" && "${counter}" < 1 )}. and put the counter under the while controller (starts with "0" and increments by 1). But it's not getting inside the while..
– Amit Ronen
Jul 12 '15 at 6:33
I managed to solve this one. The problem was with the quotes on "counter" var. So it's getting into the while controller but stops only after "counter" 1, even though the first two "active_status" are not active so it should continue to the next one
– Amit Ronen
Jul 12 '15 at 6:49
But in that case, won't it just run on all "active_status"? If if get it right, with this option, it will run on all "active_status_(number)" and make the report action on all of them which are active. I don't need to report more than once. So to explain again: Run on active_status_1 -> if active -> report and stop the loop. Only if not active -> skip to active_status_2 -> if active - > report and stop
– Amit Ronen
Jul 12 '15 at 9:02
I updated my post with screenshot trying your solution. The action (report) is done on a media which is not active .(INACTIVE_FORCED_ADMIN in this case).
– Amit Ronen
Jul 12 '15 at 9:59
Added requested screenshots
– Amit Ronen
Jul 12 '15 at 10:14
|
show 3 more comments
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Use :
User Parameters PreProcessor once as a child of a Sampler before the ForEach Controller to init RUN_ONCE to false:
and once as a child of the HTTP Request that runs on active status to set RUN_ONCE to true
ForEach Controller with following settings:
If Controller and put in condition:
${__jexl2( "${status}" == "ACTIVE" && "${RUN_ONCE}" == "false")}
- Test Plan would look like this:
You counter should be in ForEachController not in If Controller as it will not increment correctly and give the ID for the correct status
Use :
User Parameters PreProcessor once as a child of a Sampler before the ForEach Controller to init RUN_ONCE to false:
and once as a child of the HTTP Request that runs on active status to set RUN_ONCE to true
ForEach Controller with following settings:
If Controller and put in condition:
${__jexl2( "${status}" == "ACTIVE" && "${RUN_ONCE}" == "false")}
- Test Plan would look like this:
You counter should be in ForEachController not in If Controller as it will not increment correctly and give the ID for the correct status
edited Jul 12 '15 at 10:33
answered Jul 9 '15 at 20:46
UBIK LOAD PACK
24k43465
24k43465
Where should I put the counter? I've tried this code in While: ${__jexl2( "${active_status${counter}}" == "ACTIVE" && "${counter}" < 1 )}. and put the counter under the while controller (starts with "0" and increments by 1). But it's not getting inside the while..
– Amit Ronen
Jul 12 '15 at 6:33
I managed to solve this one. The problem was with the quotes on "counter" var. So it's getting into the while controller but stops only after "counter" 1, even though the first two "active_status" are not active so it should continue to the next one
– Amit Ronen
Jul 12 '15 at 6:49
But in that case, won't it just run on all "active_status"? If if get it right, with this option, it will run on all "active_status_(number)" and make the report action on all of them which are active. I don't need to report more than once. So to explain again: Run on active_status_1 -> if active -> report and stop the loop. Only if not active -> skip to active_status_2 -> if active - > report and stop
– Amit Ronen
Jul 12 '15 at 9:02
I updated my post with screenshot trying your solution. The action (report) is done on a media which is not active .(INACTIVE_FORCED_ADMIN in this case).
– Amit Ronen
Jul 12 '15 at 9:59
Added requested screenshots
– Amit Ronen
Jul 12 '15 at 10:14
|
show 3 more comments
Where should I put the counter? I've tried this code in While: ${__jexl2( "${active_status${counter}}" == "ACTIVE" && "${counter}" < 1 )}. and put the counter under the while controller (starts with "0" and increments by 1). But it's not getting inside the while..
– Amit Ronen
Jul 12 '15 at 6:33
I managed to solve this one. The problem was with the quotes on "counter" var. So it's getting into the while controller but stops only after "counter" 1, even though the first two "active_status" are not active so it should continue to the next one
– Amit Ronen
Jul 12 '15 at 6:49
But in that case, won't it just run on all "active_status"? If if get it right, with this option, it will run on all "active_status_(number)" and make the report action on all of them which are active. I don't need to report more than once. So to explain again: Run on active_status_1 -> if active -> report and stop the loop. Only if not active -> skip to active_status_2 -> if active - > report and stop
– Amit Ronen
Jul 12 '15 at 9:02
I updated my post with screenshot trying your solution. The action (report) is done on a media which is not active .(INACTIVE_FORCED_ADMIN in this case).
– Amit Ronen
Jul 12 '15 at 9:59
Added requested screenshots
– Amit Ronen
Jul 12 '15 at 10:14
Where should I put the counter? I've tried this code in While: ${__jexl2( "${active_status${counter}}" == "ACTIVE" && "${counter}" < 1 )}. and put the counter under the while controller (starts with "0" and increments by 1). But it's not getting inside the while..
– Amit Ronen
Jul 12 '15 at 6:33
Where should I put the counter? I've tried this code in While: ${__jexl2( "${active_status${counter}}" == "ACTIVE" && "${counter}" < 1 )}. and put the counter under the while controller (starts with "0" and increments by 1). But it's not getting inside the while..
– Amit Ronen
Jul 12 '15 at 6:33
I managed to solve this one. The problem was with the quotes on "counter" var. So it's getting into the while controller but stops only after "counter" 1, even though the first two "active_status" are not active so it should continue to the next one
– Amit Ronen
Jul 12 '15 at 6:49
I managed to solve this one. The problem was with the quotes on "counter" var. So it's getting into the while controller but stops only after "counter" 1, even though the first two "active_status" are not active so it should continue to the next one
– Amit Ronen
Jul 12 '15 at 6:49
But in that case, won't it just run on all "active_status"? If if get it right, with this option, it will run on all "active_status_(number)" and make the report action on all of them which are active. I don't need to report more than once. So to explain again: Run on active_status_1 -> if active -> report and stop the loop. Only if not active -> skip to active_status_2 -> if active - > report and stop
– Amit Ronen
Jul 12 '15 at 9:02
But in that case, won't it just run on all "active_status"? If if get it right, with this option, it will run on all "active_status_(number)" and make the report action on all of them which are active. I don't need to report more than once. So to explain again: Run on active_status_1 -> if active -> report and stop the loop. Only if not active -> skip to active_status_2 -> if active - > report and stop
– Amit Ronen
Jul 12 '15 at 9:02
I updated my post with screenshot trying your solution. The action (report) is done on a media which is not active .(INACTIVE_FORCED_ADMIN in this case).
– Amit Ronen
Jul 12 '15 at 9:59
I updated my post with screenshot trying your solution. The action (report) is done on a media which is not active .(INACTIVE_FORCED_ADMIN in this case).
– Amit Ronen
Jul 12 '15 at 9:59
Added requested screenshots
– Amit Ronen
Jul 12 '15 at 10:14
Added requested screenshots
– Amit Ronen
Jul 12 '15 at 10:14
|
show 3 more comments
up vote
0
down vote
You can use 'while controller' with a condition:
${__javaScript( "${some_var}" = "something" && "${some_other_var}" < "${something_else}"; )}
One of those expressions should refer to counter, another to status.
add a comment |
up vote
0
down vote
You can use 'while controller' with a condition:
${__javaScript( "${some_var}" = "something" && "${some_other_var}" < "${something_else}"; )}
One of those expressions should refer to counter, another to status.
add a comment |
up vote
0
down vote
up vote
0
down vote
You can use 'while controller' with a condition:
${__javaScript( "${some_var}" = "something" && "${some_other_var}" < "${something_else}"; )}
One of those expressions should refer to counter, another to status.
You can use 'while controller' with a condition:
${__javaScript( "${some_var}" = "something" && "${some_other_var}" < "${something_else}"; )}
One of those expressions should refer to counter, another to status.
answered Jul 9 '15 at 14:10
automatictester
1,014621
1,014621
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f31315096%2fjmeter-break-a-loop-once-the-condition-is-met%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password