添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
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
Use a while controller. Inside the while controller, use a BSF sampler to
manually set a variable to look at a flight. If it succeeds, use another BSF
sampler to set your loop exit test variable to false. If you exhaust all
flights without a success, set your loop exit test variable to false.
--
Bruce Ide
***@gmail.com
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
Post by Richard Gaywood
Hi list!
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.
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