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 <[email protected]> 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 <[email protected] > > > 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 <[email protected]> > 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 < > > [email protected] > > > > > > > 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 <[email protected]>: > > > > > > > > > Anyone to help on this? > > > > > > > > > > -- > > > > > Nasir > > > > > > > > > > > On 09-Nov-2017, at 10:59 AM, Muhammad Nasir <[email protected]> > > > 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 > > > > > > > > > > > > > > >
