jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak Shetty <>
Subject Re: Looping through all output of a RegExp extractor until a condition is met
Date Mon, 11 Jul 2011 21:19:32 GMT
it isnt necessary to use the foreach controller to loop through regex(though
it is the easiest). You can use variableName_matchNr to find out the total
number of matches , and you can use the Counter element to increment a
variable .
++Regex Extractor (variableName = links)
+WhileController(${__javaScript(${C} < ${links_matchNr})}) ==> also add the
condition to exit
++HTTPSampler  ==> use ${__V(links_${C})} to access the current result
++Counter (start=1,increment=1,maximum=${links_matchNr},referenceName=C)

should loop through all the results. All you need to decide what variable
gets set when you say succeeded (perhaps you are already extracting out some
variable and ccan check it or you should be able to check the status of the
last sampler) and then add it to the while loops condition


On Jul 11, 2011 8:26 AM, "Richard Gaywood" <> wrote:
> Hi list!
> I have a Jmeter script with a three-part process on an airline search API:
> 1. search for flights
> 2. choose a flight at random and attempt to confirm the costing (each
> flight has a unique reference number extracted from the search results via
> regexp)
> 3. if the costing succeeds, book it
> I'm only interested in the booking part, but (because of the dire state of
> the third party test system I am connecting to), about 80% of costings
> This makes for a lot of tedious Ctrl-R hammering before I get to where I
> want to be.
> Ideally, I'd modify the script to:
> 1. Search for flights
> 2. Loop through each output from the Regular Expression Extractor,
> costing each one in turn, until one succeeds
> 3. Book the one that succeeded
> So I need a sort of hybrid between the While controller (to loop until a
> costing succeeds) and the ForEach controller (to iterate around the
> reference numbers). I can't quite figure out how to do this within
> existing logic controllers though. Can anyone suggest a solution?
> Kind regards,
> Richard

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