Is there a way to count all retries as single request in JMeter

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there a way to count all retries as single request in JMeter

Muhammad Nasir
I am having false reporting due to number of retries. I have implemented a
retry mechanism as
" ${__jexl3(("${Login_Code}" != "200") && ("${Login_Counter}" <= "2"))} "

Let's say I am executing a request which retries for 2 times and then
Failed is actually reported as 3 independent requests on Aggregate/Results
Tree Reports.

Is there a way to report this as single failure because this is ultimately
a single request with 2 retries?

Note: I tried following solution and its not working either
import org.apache.jmeter.samplers.SampleResult;


if (new String(ResponseData).equals("message")) {
    SampleResult result = ctx.getCurrentSampler().sample(null);
    if (result.getResponseDataAsString().equals("message")) {
        Failure = true;
    } else {
        SampleResult.setSuccessful(true);
    }

}


Thanks,
*Nasir*
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to count all retries as single request in JMeter

Muhammad Nasir
Anyone to help on this?

--
Nasir

> On 09-Nov-2017, at 10:59 AM, Muhammad Nasir <[hidden email]> wrote:
>
> I am having false reporting due to number of retries. I have implemented a retry mechanism as
> " ${__jexl3(("${Login_Code}" != "200") && ("${Login_Counter}" <= "2"))} "
>
> Let's say I am executing a request which retries for 2 times and then Failed is actually reported as 3 independent requests on Aggregate/Results Tree Reports.
>
> Is there a way to report this as single failure because this is ultimately a single request with 2 retries?
>
> Note: I tried following solution and its not working either
> import org.apache.jmeter.samplers.SampleResult;
>
> if (new String(ResponseData).equals("message")) {
>     SampleResult result = ctx.getCurrentSampler().sample(null);
>     if (result.getResponseDataAsString().equals("message")) {
>         Failure = true;
>     } else {
>         SampleResult.setSuccessful(true);
>     }
>
> }
>
> Thanks,
> Nasir
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to count all retries as single request in JMeter

ra0077
Hi,

Use a Transaction Controller :
http://jmeter.apache.org/usermanual/component_reference.html#Transaction_Controller

Antonio


2017-11-09 18:02 GMT+01:00 Muhammad Nasir <[hidden email]>:

> Anyone to help on this?
>
> --
> Nasir
>
> > On 09-Nov-2017, at 10:59 AM, Muhammad Nasir <[hidden email]> wrote:
> >
> > I am having false reporting due to number of retries. I have implemented
> a retry mechanism as
> > " ${__jexl3(("${Login_Code}" != "200") && ("${Login_Counter}" <= "2"))} "
> >
> > Let's say I am executing a request which retries for 2 times and then
> Failed is actually reported as 3 independent requests on Aggregate/Results
> Tree Reports.
> >
> > Is there a way to report this as single failure because this is
> ultimately a single request with 2 retries?
> >
> > Note: I tried following solution and its not working either
> > import org.apache.jmeter.samplers.SampleResult;
> >
> > if (new String(ResponseData).equals("message")) {
> >     SampleResult result = ctx.getCurrentSampler().sample(null);
> >     if (result.getResponseDataAsString().equals("message")) {
> >         Failure = true;
> >     } else {
> >         SampleResult.setSuccessful(true);
> >     }
> >
> > }
> >
> > Thanks,
> > Nasir
>
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to count all retries as single request in JMeter

Muhammad Nasir
Thanks Antonio but I am not looking for this solution.

*Muhammad Nasir*
Lead Quality Assurance Engineer
*folio3* Pvt. Ltd.
www.folio3.com
Cell: +92 332 257 9082

On Fri, Nov 10, 2017 at 7:05 PM, Antonio Gomes Rodrigues <[hidden email]>
wrote:

> Hi,
>
> Use a Transaction Controller :
> http://jmeter.apache.org/usermanual/component_reference.html#Transaction_
> Controller
>
> Antonio
>
>
> 2017-11-09 18:02 GMT+01:00 Muhammad Nasir <[hidden email]>:
>
> > Anyone to help on this?
> >
> > --
> > Nasir
> >
> > > On 09-Nov-2017, at 10:59 AM, Muhammad Nasir <[hidden email]> wrote:
> > >
> > > I am having false reporting due to number of retries. I have
> implemented
> > a retry mechanism as
> > > " ${__jexl3(("${Login_Code}" != "200") && ("${Login_Counter}" <=
> "2"))} "
> > >
> > > Let's say I am executing a request which retries for 2 times and then
> > Failed is actually reported as 3 independent requests on
> Aggregate/Results
> > Tree Reports.
> > >
> > > Is there a way to report this as single failure because this is
> > ultimately a single request with 2 retries?
> > >
> > > Note: I tried following solution and its not working either
> > > import org.apache.jmeter.samplers.SampleResult;
> > >
> > > if (new String(ResponseData).equals("message")) {
> > >     SampleResult result = ctx.getCurrentSampler().sample(null);
> > >     if (result.getResponseDataAsString().equals("message")) {
> > >         Failure = true;
> > >     } else {
> > >         SampleResult.setSuccessful(true);
> > >     }
> > >
> > > }
> > >
> > > Thanks,
> > > Nasir
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to count all retries as single request in JMeter

Andrew Burton
I would expect that each call to sample() in your line:

SampleResult result = ctx.getCurrentSampler().sample(null);

would result in a new request being logged.

If you don't want to use a Transaction Controller as suggested, the only
way to "work around" this would be to write your own custom sampler that
allows for retrying based on a text response from the server.

Is there any more context for your question, e.g. why you might need to
handle multiple failures before getting the response you want?



On Sun, Nov 12, 2017 at 5:47 AM, Muhammad Nasir <[hidden email]> wrote:

> Thanks Antonio but I am not looking for this solution.
>
> *Muhammad Nasir*
> Lead Quality Assurance Engineer
> *folio3* Pvt. Ltd.
> www.folio3.com
> Cell: +92 332 257 9082
>
> On Fri, Nov 10, 2017 at 7:05 PM, Antonio Gomes Rodrigues <[hidden email]
> >
> wrote:
>
> > Hi,
> >
> > Use a Transaction Controller :
> > http://jmeter.apache.org/usermanual/component_
> reference.html#Transaction_
> > Controller
> >
> > Antonio
> >
> >
> > 2017-11-09 18:02 GMT+01:00 Muhammad Nasir <[hidden email]>:
> >
> > > Anyone to help on this?
> > >
> > > --
> > > Nasir
> > >
> > > > On 09-Nov-2017, at 10:59 AM, Muhammad Nasir <[hidden email]>
> wrote:
> > > >
> > > > I am having false reporting due to number of retries. I have
> > implemented
> > > a retry mechanism as
> > > > " ${__jexl3(("${Login_Code}" != "200") && ("${Login_Counter}" <=
> > "2"))} "
> > > >
> > > > Let's say I am executing a request which retries for 2 times and then
> > > Failed is actually reported as 3 independent requests on
> > Aggregate/Results
> > > Tree Reports.
> > > >
> > > > Is there a way to report this as single failure because this is
> > > ultimately a single request with 2 retries?
> > > >
> > > > Note: I tried following solution and its not working either
> > > > import org.apache.jmeter.samplers.SampleResult;
> > > >
> > > > if (new String(ResponseData).equals("message")) {
> > > >     SampleResult result = ctx.getCurrentSampler().sample(null);
> > > >     if (result.getResponseDataAsString().equals("message")) {
> > > >         Failure = true;
> > > >     } else {
> > > >         SampleResult.setSuccessful(true);
> > > >     }
> > > >
> > > > }
> > > >
> > > > Thanks,
> > > > Nasir
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to count all retries as single request in JMeter

Muhammad Nasir
Yes My use case is as follows:

I am testing a http API on load and client which is using this API has 30
sec request timeout implemented (This means on load some of the request may
result in request timeout error). To avoid permanent failures we have
implemented 2 retries / request on client side before marking it as failed
and I am trying to implement the same retry mechanism in JMeter load test
as well.

Now having said that, I have already implemented the retry mechanism using
while loop as:
*${__jexl3(("${Login_Code}" != "200") && ("${Login_Counter}" <= "1"))}*

but the problem with this code is that it reports all retries as separate
requests on Report which gives me false reporting.

Suppose if any request pass in 2nd retry than JMeter is reporting it as 2
requests failed and 1 Passed, which means it has skewed my results and I am
unable to identify the exact failure/success rate.

Any help or code samples to achieve this will be highly appreciated.



*Muhammad Nasir*
Lead Quality Assurance Engineer
*folio3* Pvt. Ltd.
www.folio3.com
Cell: +92 332 257 9082

On Mon, Nov 13, 2017 at 7:28 AM, Andrew Burton <[hidden email]>
wrote:

> I would expect that each call to sample() in your line:
>
> SampleResult result = ctx.getCurrentSampler().sample(null);
>
> would result in a new request being logged.
>
> If you don't want to use a Transaction Controller as suggested, the only
> way to "work around" this would be to write your own custom sampler that
> allows for retrying based on a text response from the server.
>
> Is there any more context for your question, e.g. why you might need to
> handle multiple failures before getting the response you want?
>
>
>
> On Sun, Nov 12, 2017 at 5:47 AM, Muhammad Nasir <[hidden email]> wrote:
>
> > Thanks Antonio but I am not looking for this solution.
> >
> > *Muhammad Nasir*
> > Lead Quality Assurance Engineer
> > *folio3* Pvt. Ltd.
> > www.folio3.com
> > Cell: +92 332 257 9082
> >
> > On Fri, Nov 10, 2017 at 7:05 PM, Antonio Gomes Rodrigues <
> [hidden email]
> > >
> > wrote:
> >
> > > Hi,
> > >
> > > Use a Transaction Controller :
> > > http://jmeter.apache.org/usermanual/component_
> > reference.html#Transaction_
> > > Controller
> > >
> > > Antonio
> > >
> > >
> > > 2017-11-09 18:02 GMT+01:00 Muhammad Nasir <[hidden email]>:
> > >
> > > > Anyone to help on this?
> > > >
> > > > --
> > > > Nasir
> > > >
> > > > > On 09-Nov-2017, at 10:59 AM, Muhammad Nasir <[hidden email]>
> > wrote:
> > > > >
> > > > > I am having false reporting due to number of retries. I have
> > > implemented
> > > > a retry mechanism as
> > > > > " ${__jexl3(("${Login_Code}" != "200") && ("${Login_Counter}" <=
> > > "2"))} "
> > > > >
> > > > > Let's say I am executing a request which retries for 2 times and
> then
> > > > Failed is actually reported as 3 independent requests on
> > > Aggregate/Results
> > > > Tree Reports.
> > > > >
> > > > > Is there a way to report this as single failure because this is
> > > > ultimately a single request with 2 retries?
> > > > >
> > > > > Note: I tried following solution and its not working either
> > > > > import org.apache.jmeter.samplers.SampleResult;
> > > > >
> > > > > if (new String(ResponseData).equals("message")) {
> > > > >     SampleResult result = ctx.getCurrentSampler().sample(null);
> > > > >     if (result.getResponseDataAsString().equals("message")) {
> > > > >         Failure = true;
> > > > >     } else {
> > > > >         SampleResult.setSuccessful(true);
> > > > >     }
> > > > >
> > > > > }
> > > > >
> > > > > Thanks,
> > > > > Nasir
> > > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to count all retries as single request in JMeter

Andrew Burton
Well, you definitely do want to have these as separate requests. Knowing
that possibly 2 out of every 3 attempts to login fail to return a non-200
response code is valuable data!

I would argue that a request that has timed out twice and succeeds on the
third try is not a single successful login.



On Mon, Nov 13, 2017 at 4:22 PM, Muhammad Nasir <[hidden email]> wrote:

> Yes My use case is as follows:
>
> I am testing a http API on load and client which is using this API has 30
> sec request timeout implemented (This means on load some of the request may
> result in request timeout error). To avoid permanent failures we have
> implemented 2 retries / request on client side before marking it as failed
> and I am trying to implement the same retry mechanism in JMeter load test
> as well.
>
> Now having said that, I have already implemented the retry mechanism using
> while loop as:
> *${__jexl3(("${Login_Code}" != "200") && ("${Login_Counter}" <= "1"))}*
>
> but the problem with this code is that it reports all retries as separate
> requests on Report which gives me false reporting.
>
> Suppose if any request pass in 2nd retry than JMeter is reporting it as 2
> requests failed and 1 Passed, which means it has skewed my results and I am
> unable to identify the exact failure/success rate.
>
> Any help or code samples to achieve this will be highly appreciated.
>
>
>
> *Muhammad Nasir*
> Lead Quality Assurance Engineer
> *folio3* Pvt. Ltd.
> www.folio3.com
> Cell: +92 332 257 9082
>
> On Mon, Nov 13, 2017 at 7:28 AM, Andrew Burton <[hidden email]
> >
> wrote:
>
> > I would expect that each call to sample() in your line:
> >
> > SampleResult result = ctx.getCurrentSampler().sample(null);
> >
> > would result in a new request being logged.
> >
> > If you don't want to use a Transaction Controller as suggested, the only
> > way to "work around" this would be to write your own custom sampler that
> > allows for retrying based on a text response from the server.
> >
> > Is there any more context for your question, e.g. why you might need to
> > handle multiple failures before getting the response you want?
> >
> >
> >
> > On Sun, Nov 12, 2017 at 5:47 AM, Muhammad Nasir <[hidden email]>
> wrote:
> >
> > > Thanks Antonio but I am not looking for this solution.
> > >
> > > *Muhammad Nasir*
> > > Lead Quality Assurance Engineer
> > > *folio3* Pvt. Ltd.
> > > www.folio3.com
> > > Cell: +92 332 257 9082
> > >
> > > On Fri, Nov 10, 2017 at 7:05 PM, Antonio Gomes Rodrigues <
> > [hidden email]
> > > >
> > > wrote:
> > >
> > > > Hi,
> > > >
> > > > Use a Transaction Controller :
> > > > http://jmeter.apache.org/usermanual/component_
> > > reference.html#Transaction_
> > > > Controller
> > > >
> > > > Antonio
> > > >
> > > >
> > > > 2017-11-09 18:02 GMT+01:00 Muhammad Nasir <[hidden email]>:
> > > >
> > > > > Anyone to help on this?
> > > > >
> > > > > --
> > > > > Nasir
> > > > >
> > > > > > On 09-Nov-2017, at 10:59 AM, Muhammad Nasir <[hidden email]>
> > > wrote:
> > > > > >
> > > > > > I am having false reporting due to number of retries. I have
> > > > implemented
> > > > > a retry mechanism as
> > > > > > " ${__jexl3(("${Login_Code}" != "200") && ("${Login_Counter}" <=
> > > > "2"))} "
> > > > > >
> > > > > > Let's say I am executing a request which retries for 2 times and
> > then
> > > > > Failed is actually reported as 3 independent requests on
> > > > Aggregate/Results
> > > > > Tree Reports.
> > > > > >
> > > > > > Is there a way to report this as single failure because this is
> > > > > ultimately a single request with 2 retries?
> > > > > >
> > > > > > Note: I tried following solution and its not working either
> > > > > > import org.apache.jmeter.samplers.SampleResult;
> > > > > >
> > > > > > if (new String(ResponseData).equals("message")) {
> > > > > >     SampleResult result = ctx.getCurrentSampler().sample(null);
> > > > > >     if (result.getResponseDataAsString().equals("message")) {
> > > > > >         Failure = true;
> > > > > >     } else {
> > > > > >         SampleResult.setSuccessful(true);
> > > > > >     }
> > > > > >
> > > > > > }
> > > > > >
> > > > > > Thanks,
> > > > > > Nasir
> > > > >
> > > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to count all retries as single request in JMeter

Muhammad Nasir
In my case it is.

I am trying to benchmark overall user experience performance on load. If a
user is getting a response (though little late) its fine in my case rather
being failed.
And thats the data I want like with current implementation what are my
system capabilities to successfully process requests.

*Muhammad Nasir*
Lead Quality Assurance Engineer
*folio3* Pvt. Ltd.
www.folio3.com
Cell: +92 332 257 9082

On Mon, Nov 13, 2017 at 10:50 AM, Andrew Burton <[hidden email]>
wrote:

> Well, you definitely do want to have these as separate requests. Knowing
> that possibly 2 out of every 3 attempts to login fail to return a non-200
> response code is valuable data!
>
> I would argue that a request that has timed out twice and succeeds on the
> third try is not a single successful login.
>
>
>
> On Mon, Nov 13, 2017 at 4:22 PM, Muhammad Nasir <[hidden email]> wrote:
>
> > Yes My use case is as follows:
> >
> > I am testing a http API on load and client which is using this API has 30
> > sec request timeout implemented (This means on load some of the request
> may
> > result in request timeout error). To avoid permanent failures we have
> > implemented 2 retries / request on client side before marking it as
> failed
> > and I am trying to implement the same retry mechanism in JMeter load test
> > as well.
> >
> > Now having said that, I have already implemented the retry mechanism
> using
> > while loop as:
> > *${__jexl3(("${Login_Code}" != "200") && ("${Login_Counter}" <= "1"))}*
> >
> > but the problem with this code is that it reports all retries as separate
> > requests on Report which gives me false reporting.
> >
> > Suppose if any request pass in 2nd retry than JMeter is reporting it as 2
> > requests failed and 1 Passed, which means it has skewed my results and I
> am
> > unable to identify the exact failure/success rate.
> >
> > Any help or code samples to achieve this will be highly appreciated.
> >
> >
> >
> > *Muhammad Nasir*
> > Lead Quality Assurance Engineer
> > *folio3* Pvt. Ltd.
> > www.folio3.com
> > Cell: +92 332 257 9082
> >
> > On Mon, Nov 13, 2017 at 7:28 AM, Andrew Burton <
> [hidden email]
> > >
> > wrote:
> >
> > > I would expect that each call to sample() in your line:
> > >
> > > SampleResult result = ctx.getCurrentSampler().sample(null);
> > >
> > > would result in a new request being logged.
> > >
> > > If you don't want to use a Transaction Controller as suggested, the
> only
> > > way to "work around" this would be to write your own custom sampler
> that
> > > allows for retrying based on a text response from the server.
> > >
> > > Is there any more context for your question, e.g. why you might need to
> > > handle multiple failures before getting the response you want?
> > >
> > >
> > >
> > > On Sun, Nov 12, 2017 at 5:47 AM, Muhammad Nasir <[hidden email]>
> > wrote:
> > >
> > > > Thanks Antonio but I am not looking for this solution.
> > > >
> > > > *Muhammad Nasir*
> > > > Lead Quality Assurance Engineer
> > > > *folio3* Pvt. Ltd.
> > > > www.folio3.com
> > > > Cell: +92 332 257 9082
> > > >
> > > > On Fri, Nov 10, 2017 at 7:05 PM, Antonio Gomes Rodrigues <
> > > [hidden email]
> > > > >
> > > > wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > Use a Transaction Controller :
> > > > > http://jmeter.apache.org/usermanual/component_
> > > > reference.html#Transaction_
> > > > > Controller
> > > > >
> > > > > Antonio
> > > > >
> > > > >
> > > > > 2017-11-09 18:02 GMT+01:00 Muhammad Nasir <[hidden email]>:
> > > > >
> > > > > > Anyone to help on this?
> > > > > >
> > > > > > --
> > > > > > Nasir
> > > > > >
> > > > > > > On 09-Nov-2017, at 10:59 AM, Muhammad Nasir <[hidden email]
> >
> > > > wrote:
> > > > > > >
> > > > > > > I am having false reporting due to number of retries. I have
> > > > > implemented
> > > > > > a retry mechanism as
> > > > > > > " ${__jexl3(("${Login_Code}" != "200") && ("${Login_Counter}"
> <=
> > > > > "2"))} "
> > > > > > >
> > > > > > > Let's say I am executing a request which retries for 2 times
> and
> > > then
> > > > > > Failed is actually reported as 3 independent requests on
> > > > > Aggregate/Results
> > > > > > Tree Reports.
> > > > > > >
> > > > > > > Is there a way to report this as single failure because this is
> > > > > > ultimately a single request with 2 retries?
> > > > > > >
> > > > > > > Note: I tried following solution and its not working either
> > > > > > > import org.apache.jmeter.samplers.SampleResult;
> > > > > > >
> > > > > > > if (new String(ResponseData).equals("message")) {
> > > > > > >     SampleResult result = ctx.getCurrentSampler().
> sample(null);
> > > > > > >     if (result.getResponseDataAsString().equals("message")) {
> > > > > > >         Failure = true;
> > > > > > >     } else {
> > > > > > >         SampleResult.setSuccessful(true);
> > > > > > >     }
> > > > > > >
> > > > > > > }
> > > > > > >
> > > > > > > Thanks,
> > > > > > > Nasir
> > > > > >
> > > > >
> > > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to count all retries as single request in JMeter

jmeter tea
you can check similar question with answers
https://stackoverflow.com/questions/47259211/jmeter-groovy-re-execute-a-sampler-x-times-under-condition/47259590#47259590

On Mon, Nov 13, 2017 at 7:55 AM, Muhammad Nasir <[hidden email]> wrote:

> In my case it is.
>
> I am trying to benchmark overall user experience performance on load. If a
> user is getting a response (though little late) its fine in my case rather
> being failed.
> And thats the data I want like with current implementation what are my
> system capabilities to successfully process requests.
>
> *Muhammad Nasir*
> Lead Quality Assurance Engineer
> *folio3* Pvt. Ltd.
> www.folio3.com
> Cell: +92 332 257 9082
>
> On Mon, Nov 13, 2017 at 10:50 AM, Andrew Burton <
> [hidden email]>
> wrote:
>
> > Well, you definitely do want to have these as separate requests. Knowing
> > that possibly 2 out of every 3 attempts to login fail to return a non-200
> > response code is valuable data!
> >
> > I would argue that a request that has timed out twice and succeeds on the
> > third try is not a single successful login.
> >
> >
> >
> > On Mon, Nov 13, 2017 at 4:22 PM, Muhammad Nasir <[hidden email]>
> wrote:
> >
> > > Yes My use case is as follows:
> > >
> > > I am testing a http API on load and client which is using this API has
> 30
> > > sec request timeout implemented (This means on load some of the request
> > may
> > > result in request timeout error). To avoid permanent failures we have
> > > implemented 2 retries / request on client side before marking it as
> > failed
> > > and I am trying to implement the same retry mechanism in JMeter load
> test
> > > as well.
> > >
> > > Now having said that, I have already implemented the retry mechanism
> > using
> > > while loop as:
> > > *${__jexl3(("${Login_Code}" != "200") && ("${Login_Counter}" <= "1"))}*
> > >
> > > but the problem with this code is that it reports all retries as
> separate
> > > requests on Report which gives me false reporting.
> > >
> > > Suppose if any request pass in 2nd retry than JMeter is reporting it
> as 2
> > > requests failed and 1 Passed, which means it has skewed my results and
> I
> > am
> > > unable to identify the exact failure/success rate.
> > >
> > > Any help or code samples to achieve this will be highly appreciated.
> > >
> > >
> > >
> > > *Muhammad Nasir*
> > > Lead Quality Assurance Engineer
> > > *folio3* Pvt. Ltd.
> > > www.folio3.com
> > > Cell: +92 332 257 9082
> > >
> > > On Mon, Nov 13, 2017 at 7:28 AM, Andrew Burton <
> > [hidden email]
> > > >
> > > wrote:
> > >
> > > > I would expect that each call to sample() in your line:
> > > >
> > > > SampleResult result = ctx.getCurrentSampler().sample(null);
> > > >
> > > > would result in a new request being logged.
> > > >
> > > > If you don't want to use a Transaction Controller as suggested, the
> > only
> > > > way to "work around" this would be to write your own custom sampler
> > that
> > > > allows for retrying based on a text response from the server.
> > > >
> > > > Is there any more context for your question, e.g. why you might need
> to
> > > > handle multiple failures before getting the response you want?
> > > >
> > > >
> > > >
> > > > On Sun, Nov 12, 2017 at 5:47 AM, Muhammad Nasir <[hidden email]>
> > > wrote:
> > > >
> > > > > Thanks Antonio but I am not looking for this solution.
> > > > >
> > > > > *Muhammad Nasir*
> > > > > Lead Quality Assurance Engineer
> > > > > *folio3* Pvt. Ltd.
> > > > > www.folio3.com
> > > > > Cell: +92 332 257 9082
> > > > >
> > > > > On Fri, Nov 10, 2017 at 7:05 PM, Antonio Gomes Rodrigues <
> > > > [hidden email]
> > > > > >
> > > > > wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > Use a Transaction Controller :
> > > > > > http://jmeter.apache.org/usermanual/component_
> > > > > reference.html#Transaction_
> > > > > > Controller
> > > > > >
> > > > > > Antonio
> > > > > >
> > > > > >
> > > > > > 2017-11-09 18:02 GMT+01:00 Muhammad Nasir <[hidden email]>:
> > > > > >
> > > > > > > Anyone to help on this?
> > > > > > >
> > > > > > > --
> > > > > > > Nasir
> > > > > > >
> > > > > > > > On 09-Nov-2017, at 10:59 AM, Muhammad Nasir <
> [hidden email]
> > >
> > > > > wrote:
> > > > > > > >
> > > > > > > > I am having false reporting due to number of retries. I have
> > > > > > implemented
> > > > > > > a retry mechanism as
> > > > > > > > " ${__jexl3(("${Login_Code}" != "200") && ("${Login_Counter}"
> > <=
> > > > > > "2"))} "
> > > > > > > >
> > > > > > > > Let's say I am executing a request which retries for 2 times
> > and
> > > > then
> > > > > > > Failed is actually reported as 3 independent requests on
> > > > > > Aggregate/Results
> > > > > > > Tree Reports.
> > > > > > > >
> > > > > > > > Is there a way to report this as single failure because this
> is
> > > > > > > ultimately a single request with 2 retries?
> > > > > > > >
> > > > > > > > Note: I tried following solution and its not working either
> > > > > > > > import org.apache.jmeter.samplers.SampleResult;
> > > > > > > >
> > > > > > > > if (new String(ResponseData).equals("message")) {
> > > > > > > >     SampleResult result = ctx.getCurrentSampler().
> > sample(null);
> > > > > > > >     if (result.getResponseDataAsString().equals("message"))
> {
> > > > > > > >         Failure = true;
> > > > > > > >     } else {
> > > > > > > >         SampleResult.setSuccessful(true);
> > > > > > > >     }
> > > > > > > >
> > > > > > > > }
> > > > > > > >
> > > > > > > > Thanks,
> > > > > > > > Nasir
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to count all retries as single request in JMeter

Muhammad Nasir
I think you are not getting my question. I have already implemented retries
and now trying to fix false reporting for benchmarking.
--Nasir

On Mon, Nov 13, 2017 at 4:59 PM, jmeter tea <[hidden email]> wrote:

> you can check similar question with answers
> https://stackoverflow.com/questions/47259211/jmeter-groovy-
> re-execute-a-sampler-x-times-under-condition/47259590#47259590
>
> On Mon, Nov 13, 2017 at 7:55 AM, Muhammad Nasir <[hidden email]> wrote:
>
> > In my case it is.
> >
> > I am trying to benchmark overall user experience performance on load. If
> a
> > user is getting a response (though little late) its fine in my case
> rather
> > being failed.
> > And thats the data I want like with current implementation what are my
> > system capabilities to successfully process requests.
> >
> >
> > On Mon, Nov 13, 2017 at 10:50 AM, Andrew Burton <
> > [hidden email]>
> > wrote:
> >
> > > Well, you definitely do want to have these as separate requests.
> Knowing
> > > that possibly 2 out of every 3 attempts to login fail to return a
> non-200
> > > response code is valuable data!
> > >
> > > I would argue that a request that has timed out twice and succeeds on
> the
> > > third try is not a single successful login.
> > >
> > >
> > >
> > > On Mon, Nov 13, 2017 at 4:22 PM, Muhammad Nasir <[hidden email]>
> > wrote:
> > >
> > > > Yes My use case is as follows:
> > > >
> > > > I am testing a http API on load and client which is using this API
> has
> > 30
> > > > sec request timeout implemented (This means on load some of the
> request
> > > may
> > > > result in request timeout error). To avoid permanent failures we have
> > > > implemented 2 retries / request on client side before marking it as
> > > failed
> > > > and I am trying to implement the same retry mechanism in JMeter load
> > test
> > > > as well.
> > > >
> > > > Now having said that, I have already implemented the retry mechanism
> > > using
> > > > while loop as:
> > > > *${__jexl3(("${Login_Code}" != "200") && ("${Login_Counter}" <=
> "1"))}*
> > > >
> > > > but the problem with this code is that it reports all retries as
> > separate
> > > > requests on Report which gives me false reporting.
> > > >
> > > > Suppose if any request pass in 2nd retry than JMeter is reporting it
> > as 2
> > > > requests failed and 1 Passed, which means it has skewed my results
> and
> > I
> > > am
> > > > unable to identify the exact failure/success rate.
> > > >
> > > > Any help or code samples to achieve this will be highly appreciated.
> > > >
> > > >
> > > >
> > > >
> > > > On Mon, Nov 13, 2017 at 7:28 AM, Andrew Burton <
> > > [hidden email]
> > > > >
> > > > wrote:
> > > >
> > > > > I would expect that each call to sample() in your line:
> > > > >
> > > > > SampleResult result = ctx.getCurrentSampler().sample(null);
> > > > >
> > > > > would result in a new request being logged.
> > > > >
> > > > > If you don't want to use a Transaction Controller as suggested, the
> > > only
> > > > > way to "work around" this would be to write your own custom sampler
> > > that
> > > > > allows for retrying based on a text response from the server.
> > > > >
> > > > > Is there any more context for your question, e.g. why you might
> need
> > to
> > > > > handle multiple failures before getting the response you want?
> > > > >
> > > > >
> > > > >
> > > > > On Sun, Nov 12, 2017 at 5:47 AM, Muhammad Nasir <[hidden email]
> >
> > > > wrote:
> > > > >
> > > > > > Thanks Antonio but I am not looking for this solution.
> > > > > >
> > > > > >
> > > > > > On Fri, Nov 10, 2017 at 7:05 PM, Antonio Gomes Rodrigues <
> > > > > [hidden email]
> > > > > > >
> > > > > > wrote:
> > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > > Use a Transaction Controller :
> > > > > > > http://jmeter.apache.org/usermanual/component_
> > > > > > reference.html#Transaction_
> > > > > > > Controller
> > > > > > >
> > > > > > > Antonio
> > > > > > >
> > > > > > >
> > > > > > > 2017-11-09 18:02 GMT+01:00 Muhammad Nasir <[hidden email]>:
> > > > > > >
> > > > > > > > Anyone to help on this?
> > > > > > > >
> > > > > > > > --
> > > > > > > > Nasir
> > > > > > > >
> > > > > > > > > On 09-Nov-2017, at 10:59 AM, Muhammad Nasir <
> > [hidden email]
> > > >
> > > > > > wrote:
> > > > > > > > >
> > > > > > > > > I am having false reporting due to number of retries. I
> have
> > > > > > > implemented
> > > > > > > > a retry mechanism as
> > > > > > > > > " ${__jexl3(("${Login_Code}" != "200") &&
> ("${Login_Counter}"
> > > <=
> > > > > > > "2"))} "
> > > > > > > > >
> > > > > > > > > Let's say I am executing a request which retries for 2
> times
> > > and
> > > > > then
> > > > > > > > Failed is actually reported as 3 independent requests on
> > > > > > > Aggregate/Results
> > > > > > > > Tree Reports.
> > > > > > > > >
> > > > > > > > > Is there a way to report this as single failure because
> this
> > is
> > > > > > > > ultimately a single request with 2 retries?
> > > > > > > > >
> > > > > > > > > Note: I tried following solution and its not working either
> > > > > > > > > import org.apache.jmeter.samplers.SampleResult;
> > > > > > > > >
> > > > > > > > > if (new String(ResponseData).equals("message")) {
> > > > > > > > >     SampleResult result = ctx.getCurrentSampler().
> > > sample(null);
> > > > > > > > >     if (result.getResponseDataAsStrin
> g().equals("message"))
> > {
> > > > > > > > >         Failure = true;
> > > > > > > > >     } else {
> > > > > > > > >         SampleResult.setSuccessful(true);
> > > > > > > > >     }
> > > > > > > > >
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > > Thanks,
> > > > > > > > > Nasir
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to count all retries as single request in JMeter

Muhammad Nasir
In reply to this post by ra0077
Hello Antonio,

Is there a way to mark transaction controller result as Successful if any
of child sampler passes?
Thanks for your feedback.

--Nasir
On Fri, Nov 10, 2017 at 7:05 PM, Antonio Gomes Rodrigues <[hidden email]>
wrote:

> Hi,
>
> Use a Transaction Controller :
> http://jmeter.apache.org/usermanual/component_reference.html#Transaction_
> Controller
>
> Antonio
>
>
> 2017-11-09 18:02 GMT+01:00 Muhammad Nasir <[hidden email]>:
>
> > Anyone to help on this?
> >
> > --
> > Nasir
> >
> > > On 09-Nov-2017, at 10:59 AM, Muhammad Nasir <[hidden email]> wrote:
> > >
> > > I am having false reporting due to number of retries. I have
> implemented
> > a retry mechanism as
> > > " ${__jexl3(("${Login_Code}" != "200") && ("${Login_Counter}" <=
> "2"))} "
> > >
> > > Let's say I am executing a request which retries for 2 times and then
> > Failed is actually reported as 3 independent requests on
> Aggregate/Results
> > Tree Reports.
> > >
> > > Is there a way to report this as single failure because this is
> > ultimately a single request with 2 retries?
> > >
> > > Note: I tried following solution and its not working either
> > > import org.apache.jmeter.samplers.SampleResult;
> > >
> > > if (new String(ResponseData).equals("message")) {
> > >     SampleResult result = ctx.getCurrentSampler().sample(null);
> > >     if (result.getResponseDataAsString().equals("message")) {
> > >         Failure = true;
> > >     } else {
> > >         SampleResult.setSuccessful(true);
> > >     }
> > >
> > > }
> > >
> > > Thanks,
> > > Nasir
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to count all retries as single request in JMeter

shettyd
I'd probably use a transaction controller + custom assertions (it should
mark every retry other than the last successful , even if status is not 200)
http://jmeter.apache.org/usermanual/component_reference.html#Transaction_Controller

I do think this might be easier to do in your report rather than trying to
manipulate your test -Let Jmeter generate its raw data (all samples that
are retried can use a sample name naming pattern to figure out they are the
same thing) and then when you report exclude whatever you dont want.

On Mon, Nov 13, 2017 at 6:44 AM, Muhammad Nasir <[hidden email]> wrote:

> Hello Antonio,
>
> Is there a way to mark transaction controller result as Successful if any
> of child sampler passes?
> Thanks for your feedback.
>
> --Nasir
> On Fri, Nov 10, 2017 at 7:05 PM, Antonio Gomes Rodrigues <[hidden email]
> >
> wrote:
>
> > Hi,
> >
> > Use a Transaction Controller :
> > http://jmeter.apache.org/usermanual/component_
> reference.html#Transaction_
> > Controller
> >
> > Antonio
> >
> >
> > 2017-11-09 18:02 GMT+01:00 Muhammad Nasir <[hidden email]>:
> >
> > > Anyone to help on this?
> > >
> > > --
> > > Nasir
> > >
> > > > On 09-Nov-2017, at 10:59 AM, Muhammad Nasir <[hidden email]>
> wrote:
> > > >
> > > > I am having false reporting due to number of retries. I have
> > implemented
> > > a retry mechanism as
> > > > " ${__jexl3(("${Login_Code}" != "200") && ("${Login_Counter}" <=
> > "2"))} "
> > > >
> > > > Let's say I am executing a request which retries for 2 times and then
> > > Failed is actually reported as 3 independent requests on
> > Aggregate/Results
> > > Tree Reports.
> > > >
> > > > Is there a way to report this as single failure because this is
> > > ultimately a single request with 2 retries?
> > > >
> > > > Note: I tried following solution and its not working either
> > > > import org.apache.jmeter.samplers.SampleResult;
> > > >
> > > > if (new String(ResponseData).equals("message")) {
> > > >     SampleResult result = ctx.getCurrentSampler().sample(null);
> > > >     if (result.getResponseDataAsString().equals("message")) {
> > > >         Failure = true;
> > > >     } else {
> > > >         SampleResult.setSuccessful(true);
> > > >     }
> > > >
> > > > }
> > > >
> > > > Thanks,
> > > > Nasir
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to count all retries as single request in JMeter

Muhammad Nasir
Is there a way to mark transaction controller result as Successful if any
of child sampler passes? According to JMeter documentation "The generated
sample is only regarded as successful if all its sub-samples are
successful."

-Nasir

On Mon, Nov 13, 2017 at 10:58 PM, Deepak Shetty <[hidden email]> wrote:

> I'd probably use a transaction controller + custom assertions (it should
> mark every retry other than the last successful , even if status is not
> 200)
> http://jmeter.apache.org/usermanual/component_reference.
> html#Transaction_Controller
>
> I do think this might be easier to do in your report rather than trying to
> manipulate your test -Let Jmeter generate its raw data (all samples that
> are retried can use a sample name naming pattern to figure out they are the
> same thing) and then when you report exclude whatever you dont want.
>
> On Mon, Nov 13, 2017 at 6:44 AM, Muhammad Nasir <[hidden email]> wrote:
>
> > Hello Antonio,
> >
> > Is there a way to mark transaction controller result as Successful if any
> > of child sampler passes?
> > Thanks for your feedback.
> >
> > --Nasir
> > On Fri, Nov 10, 2017 at 7:05 PM, Antonio Gomes Rodrigues <
> [hidden email]
> > >
> > wrote:
> >
> > > Hi,
> > >
> > > Use a Transaction Controller :
> > > http://jmeter.apache.org/usermanual/component_
> > reference.html#Transaction_
> > > Controller
> > >
> > > Antonio
> > >
> > >
> > > 2017-11-09 18:02 GMT+01:00 Muhammad Nasir <[hidden email]>:
> > >
> > > > Anyone to help on this?
> > > >
> > > > --
> > > > Nasir
> > > >
> > > > > On 09-Nov-2017, at 10:59 AM, Muhammad Nasir <[hidden email]>
> > wrote:
> > > > >
> > > > > I am having false reporting due to number of retries. I have
> > > implemented
> > > > a retry mechanism as
> > > > > " ${__jexl3(("${Login_Code}" != "200") && ("${Login_Counter}" <=
> > > "2"))} "
> > > > >
> > > > > Let's say I am executing a request which retries for 2 times and
> then
> > > > Failed is actually reported as 3 independent requests on
> > > Aggregate/Results
> > > > Tree Reports.
> > > > >
> > > > > Is there a way to report this as single failure because this is
> > > > ultimately a single request with 2 retries?
> > > > >
> > > > > Note: I tried following solution and its not working either
> > > > > import org.apache.jmeter.samplers.SampleResult;
> > > > >
> > > > > if (new String(ResponseData).equals("message")) {
> > > > >     SampleResult result = ctx.getCurrentSampler().sample(null);
> > > > >     if (result.getResponseDataAsString().equals("message")) {
> > > > >         Failure = true;
> > > > >     } else {
> > > > >         SampleResult.setSuccessful(true);
> > > > >     }
> > > > >
> > > > > }
> > > > >
> > > > > Thanks,
> > > > > Nasir
> > > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to count all retries as single request in JMeter

shettyd
Hi
>"The generated sample is only regarded as successful if all its
sub-samples are successful."
Hence use your own custom assertion e.g.
http://jmeter.apache.org/usermanual/component_reference.html#JSR223_Assertion
(it possible to use the other assertions also depending on what gets
returned)

regards
deepak


On Mon, Nov 13, 2017 at 10:10 PM, Muhammad Nasir <[hidden email]> wrote:

> Is there a way to mark transaction controller result as Successful if any
> of child sampler passes? According to JMeter documentation "The generated
> sample is only regarded as successful if all its sub-samples are
> successful."
>
> -Nasir
>
> On Mon, Nov 13, 2017 at 10:58 PM, Deepak Shetty <[hidden email]> wrote:
>
> > I'd probably use a transaction controller + custom assertions (it should
> > mark every retry other than the last successful , even if status is not
> > 200)
> > http://jmeter.apache.org/usermanual/component_reference.
> > html#Transaction_Controller
> >
> > I do think this might be easier to do in your report rather than trying
> to
> > manipulate your test -Let Jmeter generate its raw data (all samples that
> > are retried can use a sample name naming pattern to figure out they are
> the
> > same thing) and then when you report exclude whatever you dont want.
> >
> > On Mon, Nov 13, 2017 at 6:44 AM, Muhammad Nasir <[hidden email]>
> wrote:
> >
> > > Hello Antonio,
> > >
> > > Is there a way to mark transaction controller result as Successful if
> any
> > > of child sampler passes?
> > > Thanks for your feedback.
> > >
> > > --Nasir
> > > On Fri, Nov 10, 2017 at 7:05 PM, Antonio Gomes Rodrigues <
> > [hidden email]
> > > >
> > > wrote:
> > >
> > > > Hi,
> > > >
> > > > Use a Transaction Controller :
> > > > http://jmeter.apache.org/usermanual/component_
> > > reference.html#Transaction_
> > > > Controller
> > > >
> > > > Antonio
> > > >
> > > >
> > > > 2017-11-09 18:02 GMT+01:00 Muhammad Nasir <[hidden email]>:
> > > >
> > > > > Anyone to help on this?
> > > > >
> > > > > --
> > > > > Nasir
> > > > >
> > > > > > On 09-Nov-2017, at 10:59 AM, Muhammad Nasir <[hidden email]>
> > > wrote:
> > > > > >
> > > > > > I am having false reporting due to number of retries. I have
> > > > implemented
> > > > > a retry mechanism as
> > > > > > " ${__jexl3(("${Login_Code}" != "200") && ("${Login_Counter}" <=
> > > > "2"))} "
> > > > > >
> > > > > > Let's say I am executing a request which retries for 2 times and
> > then
> > > > > Failed is actually reported as 3 independent requests on
> > > > Aggregate/Results
> > > > > Tree Reports.
> > > > > >
> > > > > > Is there a way to report this as single failure because this is
> > > > > ultimately a single request with 2 retries?
> > > > > >
> > > > > > Note: I tried following solution and its not working either
> > > > > > import org.apache.jmeter.samplers.SampleResult;
> > > > > >
> > > > > > if (new String(ResponseData).equals("message")) {
> > > > > >     SampleResult result = ctx.getCurrentSampler().sample(null);
> > > > > >     if (result.getResponseDataAsString().equals("message")) {
> > > > > >         Failure = true;
> > > > > >     } else {
> > > > > >         SampleResult.setSuccessful(true);
> > > > > >     }
> > > > > >
> > > > > > }
> > > > > >
> > > > > > Thanks,
> > > > > > Nasir
> > > > >
> > > >
> > >
> >
>