Hi 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 . So ThreadGroup +HttpSampler ++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 regards deepak On Jul 11, 2011 8:26 AM, "Richard Gaywood" <richardgayw...@gmail.com> 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 a > 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 fail. > 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 JMeter's > existing logic controllers though. Can anyone suggest a solution? > > Kind regards, > > Richard