jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Muhammad Nasir <mna...@folio3.com>
Subject Re: Is there a way to count all retries as single request in JMeter
Date Mon, 13 Nov 2017 05:22:25 GMT
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 <andrewburtonatwh@gmail.com>
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 <mnasir@folio3.com> 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 <
> ra0077@gmail.com
> > >
> > 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 <mnasir@folio3.com>:
> > >
> > > > Anyone to help on this?
> > > >
> > > > --
> > > > Nasir
> > > >
> > > > > On 09-Nov-2017, at 10:59 AM, Muhammad Nasir <mnasir@folio3.com>
> > 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
> > > >
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message