Logic design in jmeter - pass errors in test flow chainIgnoring errors in JMeterjmeter regarding performance and load testingJmeter Reports do not get generated if there are errors if the Jmeter Test executed using Jmeter Maven PluginHow the JMeter script can return 0/1 = pass/fail on the command line?In Jmeter 2.13, How to make Non-HTML resource errors as warnings?JMeter doesn't fail on BeanShell errorscan not pass variable to sampler's assertion in Jmeter - GroovyJMeter Exceptions Java.net.BindException during Test Execution windowJMeter - How to make post processors reusable and use them on top of a test fragment on demandJmeter WebDriver Sampler resulting in 'unknown protocol: data'
Why does Japan use the same type of AC power outlet as the US?
Why did Saruman lie?
Would the USA be eligible to join the European Union?
What would it take to get a message to another star?
Scam? Phone call from "Department of Social Security" asking me to call back
Heating Margarine in Pan = loss of calories?
What is the farthest a camera can see?
What are those bumps on top of the Antonov-225?
How much can I judge a company based on a phone screening?
Do beef farmed pastures net remove carbon emissions?
Help, I cannot decide when to start the story
Does fossil fuels use since 1990 account for half of all the fossil fuels used in history?
Does an object storing more internal energy emit more thermal radiation?
Why is the result of ('b'+'a'+ + 'a' + 'a').toLowerCase() 'banana'?
How do I call a 6-digit Australian phone number with a US-based mobile phone?
Decipher case notes extract
How to Configure Ubuntu to Access Internet only with Wifi Ignoring Wire Connection (Ethernet)
A trip to the library
How can I find an old paper when the usual methods fail?
How far did Gandalf and the Balrog drop from the bridge in Moria?
Did DOS zero out the BSS area when it loaded a program?
Escape Velocity - Won't the orbital path just become larger with higher initial velocity?
What unique challenges/limitations will I face if I start a career as a pilot at 45 years old?
Why does the cable resistance jump from a low value to high value at a particular frequency?
Logic design in jmeter - pass errors in test flow chain
Ignoring errors in JMeterjmeter regarding performance and load testingJmeter Reports do not get generated if there are errors if the Jmeter Test executed using Jmeter Maven PluginHow the JMeter script can return 0/1 = pass/fail on the command line?In Jmeter 2.13, How to make Non-HTML resource errors as warnings?JMeter doesn't fail on BeanShell errorscan not pass variable to sampler's assertion in Jmeter - GroovyJMeter Exceptions Java.net.BindException during Test Execution windowJMeter - How to make post processors reusable and use them on top of a test fragment on demandJmeter WebDriver Sampler resulting in 'unknown protocol: data'
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
please advice what has to be the good design and implementation of the following scenario I'm faced with.
Design
Sampler 1 (prerequisite)
Sampler 2 (prerequisite)
Sampler 3 (actual test)
Execution
Sampler 1 failed with error
Sampler 2 not executed
Sampler 3 not executed but marked as failed with Sampler 1 error or executed but result data replaced with error from Sampler 1
Note: Prerequisite samplers are excluded from end result report(already found solution for that).
jmeter
add a comment |
please advice what has to be the good design and implementation of the following scenario I'm faced with.
Design
Sampler 1 (prerequisite)
Sampler 2 (prerequisite)
Sampler 3 (actual test)
Execution
Sampler 1 failed with error
Sampler 2 not executed
Sampler 3 not executed but marked as failed with Sampler 1 error or executed but result data replaced with error from Sampler 1
Note: Prerequisite samplers are excluded from end result report(already found solution for that).
jmeter
add a comment |
please advice what has to be the good design and implementation of the following scenario I'm faced with.
Design
Sampler 1 (prerequisite)
Sampler 2 (prerequisite)
Sampler 3 (actual test)
Execution
Sampler 1 failed with error
Sampler 2 not executed
Sampler 3 not executed but marked as failed with Sampler 1 error or executed but result data replaced with error from Sampler 1
Note: Prerequisite samplers are excluded from end result report(already found solution for that).
jmeter
please advice what has to be the good design and implementation of the following scenario I'm faced with.
Design
Sampler 1 (prerequisite)
Sampler 2 (prerequisite)
Sampler 3 (actual test)
Execution
Sampler 1 failed with error
Sampler 2 not executed
Sampler 3 not executed but marked as failed with Sampler 1 error or executed but result data replaced with error from Sampler 1
Note: Prerequisite samplers are excluded from end result report(already found solution for that).
jmeter
jmeter
asked Mar 27 at 10:34
Nikolay MarinovNikolay Marinov
241 silver badge8 bronze badges
241 silver badge8 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You can design your test as follows:
Sampler 1
JSR223 PostProcessor with the following code:
if (!prev.isSuccessful())
vars.putObject('sampler1Result', prev)
If Controller with the following condition:$JMeterThread.last_sample_ok- Sampler 2
Sampler 3
JSR223 PostProcessor with the following code:
if (vars.getObject('sampler1Result') != null)
def sampler1Result = vars.getObject('sampler1Result')
prev.setSuccessful(sampler1Result.isSuccessful())
prev.setResponseCode(sampler1Result.getResponseCode())
prev.setResponseMessage(sampler1Result.getResponseMessage())
prev.setResponseData(sampler1Result.getResponseData())
Where:
vars- is a shorthand for JMeterVariables class instanceprev- is a shorthand for HTTPSampleResult class instance

Thanks Dmitri, seems to be work for me. Can you please advice how to add also failed sampler name with error returned in the Sampler 3 response
– Nikolay Marinov
Mar 28 at 15:19
sampler1Result.getSampleLabel()should return the name of theSampler1. See SampleResult JavaDoc in particular and Top 8 JMeter Java Classes You Should Be Using with Groovy in general for more details.
– Dmitri T
Mar 28 at 15:32
Already did, but not sure how to merge both in prev.setResponseData. I'm getting this on prev.setResponseData(sampler1Result.getSampleLabel() + sampler1Result.getResponseData()) - jp@gc - Dummy Sampler[83, 97, 109, 112, 108, 101, 114, 32, 49, 32, 114, 101, 115, 112, 111, 110, 115, 101]
– Nikolay Marinov
Mar 28 at 15:39
Had to use getResponseDataAsString instead of getResponseData
– Nikolay Marinov
Mar 29 at 9:17
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55375102%2flogic-design-in-jmeter-pass-errors-in-test-flow-chain%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can design your test as follows:
Sampler 1
JSR223 PostProcessor with the following code:
if (!prev.isSuccessful())
vars.putObject('sampler1Result', prev)
If Controller with the following condition:$JMeterThread.last_sample_ok- Sampler 2
Sampler 3
JSR223 PostProcessor with the following code:
if (vars.getObject('sampler1Result') != null)
def sampler1Result = vars.getObject('sampler1Result')
prev.setSuccessful(sampler1Result.isSuccessful())
prev.setResponseCode(sampler1Result.getResponseCode())
prev.setResponseMessage(sampler1Result.getResponseMessage())
prev.setResponseData(sampler1Result.getResponseData())
Where:
vars- is a shorthand for JMeterVariables class instanceprev- is a shorthand for HTTPSampleResult class instance

Thanks Dmitri, seems to be work for me. Can you please advice how to add also failed sampler name with error returned in the Sampler 3 response
– Nikolay Marinov
Mar 28 at 15:19
sampler1Result.getSampleLabel()should return the name of theSampler1. See SampleResult JavaDoc in particular and Top 8 JMeter Java Classes You Should Be Using with Groovy in general for more details.
– Dmitri T
Mar 28 at 15:32
Already did, but not sure how to merge both in prev.setResponseData. I'm getting this on prev.setResponseData(sampler1Result.getSampleLabel() + sampler1Result.getResponseData()) - jp@gc - Dummy Sampler[83, 97, 109, 112, 108, 101, 114, 32, 49, 32, 114, 101, 115, 112, 111, 110, 115, 101]
– Nikolay Marinov
Mar 28 at 15:39
Had to use getResponseDataAsString instead of getResponseData
– Nikolay Marinov
Mar 29 at 9:17
add a comment |
You can design your test as follows:
Sampler 1
JSR223 PostProcessor with the following code:
if (!prev.isSuccessful())
vars.putObject('sampler1Result', prev)
If Controller with the following condition:$JMeterThread.last_sample_ok- Sampler 2
Sampler 3
JSR223 PostProcessor with the following code:
if (vars.getObject('sampler1Result') != null)
def sampler1Result = vars.getObject('sampler1Result')
prev.setSuccessful(sampler1Result.isSuccessful())
prev.setResponseCode(sampler1Result.getResponseCode())
prev.setResponseMessage(sampler1Result.getResponseMessage())
prev.setResponseData(sampler1Result.getResponseData())
Where:
vars- is a shorthand for JMeterVariables class instanceprev- is a shorthand for HTTPSampleResult class instance

Thanks Dmitri, seems to be work for me. Can you please advice how to add also failed sampler name with error returned in the Sampler 3 response
– Nikolay Marinov
Mar 28 at 15:19
sampler1Result.getSampleLabel()should return the name of theSampler1. See SampleResult JavaDoc in particular and Top 8 JMeter Java Classes You Should Be Using with Groovy in general for more details.
– Dmitri T
Mar 28 at 15:32
Already did, but not sure how to merge both in prev.setResponseData. I'm getting this on prev.setResponseData(sampler1Result.getSampleLabel() + sampler1Result.getResponseData()) - jp@gc - Dummy Sampler[83, 97, 109, 112, 108, 101, 114, 32, 49, 32, 114, 101, 115, 112, 111, 110, 115, 101]
– Nikolay Marinov
Mar 28 at 15:39
Had to use getResponseDataAsString instead of getResponseData
– Nikolay Marinov
Mar 29 at 9:17
add a comment |
You can design your test as follows:
Sampler 1
JSR223 PostProcessor with the following code:
if (!prev.isSuccessful())
vars.putObject('sampler1Result', prev)
If Controller with the following condition:$JMeterThread.last_sample_ok- Sampler 2
Sampler 3
JSR223 PostProcessor with the following code:
if (vars.getObject('sampler1Result') != null)
def sampler1Result = vars.getObject('sampler1Result')
prev.setSuccessful(sampler1Result.isSuccessful())
prev.setResponseCode(sampler1Result.getResponseCode())
prev.setResponseMessage(sampler1Result.getResponseMessage())
prev.setResponseData(sampler1Result.getResponseData())
Where:
vars- is a shorthand for JMeterVariables class instanceprev- is a shorthand for HTTPSampleResult class instance

You can design your test as follows:
Sampler 1
JSR223 PostProcessor with the following code:
if (!prev.isSuccessful())
vars.putObject('sampler1Result', prev)
If Controller with the following condition:$JMeterThread.last_sample_ok- Sampler 2
Sampler 3
JSR223 PostProcessor with the following code:
if (vars.getObject('sampler1Result') != null)
def sampler1Result = vars.getObject('sampler1Result')
prev.setSuccessful(sampler1Result.isSuccessful())
prev.setResponseCode(sampler1Result.getResponseCode())
prev.setResponseMessage(sampler1Result.getResponseMessage())
prev.setResponseData(sampler1Result.getResponseData())
Where:
vars- is a shorthand for JMeterVariables class instanceprev- is a shorthand for HTTPSampleResult class instance

answered Mar 27 at 11:45
Dmitri TDmitri T
80.9k3 gold badges43 silver badges72 bronze badges
80.9k3 gold badges43 silver badges72 bronze badges
Thanks Dmitri, seems to be work for me. Can you please advice how to add also failed sampler name with error returned in the Sampler 3 response
– Nikolay Marinov
Mar 28 at 15:19
sampler1Result.getSampleLabel()should return the name of theSampler1. See SampleResult JavaDoc in particular and Top 8 JMeter Java Classes You Should Be Using with Groovy in general for more details.
– Dmitri T
Mar 28 at 15:32
Already did, but not sure how to merge both in prev.setResponseData. I'm getting this on prev.setResponseData(sampler1Result.getSampleLabel() + sampler1Result.getResponseData()) - jp@gc - Dummy Sampler[83, 97, 109, 112, 108, 101, 114, 32, 49, 32, 114, 101, 115, 112, 111, 110, 115, 101]
– Nikolay Marinov
Mar 28 at 15:39
Had to use getResponseDataAsString instead of getResponseData
– Nikolay Marinov
Mar 29 at 9:17
add a comment |
Thanks Dmitri, seems to be work for me. Can you please advice how to add also failed sampler name with error returned in the Sampler 3 response
– Nikolay Marinov
Mar 28 at 15:19
sampler1Result.getSampleLabel()should return the name of theSampler1. See SampleResult JavaDoc in particular and Top 8 JMeter Java Classes You Should Be Using with Groovy in general for more details.
– Dmitri T
Mar 28 at 15:32
Already did, but not sure how to merge both in prev.setResponseData. I'm getting this on prev.setResponseData(sampler1Result.getSampleLabel() + sampler1Result.getResponseData()) - jp@gc - Dummy Sampler[83, 97, 109, 112, 108, 101, 114, 32, 49, 32, 114, 101, 115, 112, 111, 110, 115, 101]
– Nikolay Marinov
Mar 28 at 15:39
Had to use getResponseDataAsString instead of getResponseData
– Nikolay Marinov
Mar 29 at 9:17
Thanks Dmitri, seems to be work for me. Can you please advice how to add also failed sampler name with error returned in the Sampler 3 response
– Nikolay Marinov
Mar 28 at 15:19
Thanks Dmitri, seems to be work for me. Can you please advice how to add also failed sampler name with error returned in the Sampler 3 response
– Nikolay Marinov
Mar 28 at 15:19
sampler1Result.getSampleLabel() should return the name of the Sampler1. See SampleResult JavaDoc in particular and Top 8 JMeter Java Classes You Should Be Using with Groovy in general for more details.– Dmitri T
Mar 28 at 15:32
sampler1Result.getSampleLabel() should return the name of the Sampler1. See SampleResult JavaDoc in particular and Top 8 JMeter Java Classes You Should Be Using with Groovy in general for more details.– Dmitri T
Mar 28 at 15:32
Already did, but not sure how to merge both in prev.setResponseData. I'm getting this on prev.setResponseData(sampler1Result.getSampleLabel() + sampler1Result.getResponseData()) - jp@gc - Dummy Sampler[83, 97, 109, 112, 108, 101, 114, 32, 49, 32, 114, 101, 115, 112, 111, 110, 115, 101]
– Nikolay Marinov
Mar 28 at 15:39
Already did, but not sure how to merge both in prev.setResponseData. I'm getting this on prev.setResponseData(sampler1Result.getSampleLabel() + sampler1Result.getResponseData()) - jp@gc - Dummy Sampler[83, 97, 109, 112, 108, 101, 114, 32, 49, 32, 114, 101, 115, 112, 111, 110, 115, 101]
– Nikolay Marinov
Mar 28 at 15:39
Had to use getResponseDataAsString instead of getResponseData
– Nikolay Marinov
Mar 29 at 9:17
Had to use getResponseDataAsString instead of getResponseData
– Nikolay Marinov
Mar 29 at 9:17
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55375102%2flogic-design-in-jmeter-pass-errors-in-test-flow-chain%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown