Reputation: 97
I have a JSR223 Sampler where i am getting two values and based on that two values, i have to make nested Switch controller ,
vars.put('counts',new
groovy.json.JsonSlurper().parse(prev.getResponseData()).options.size() as
String)
if (Count==1) {
vars.put('Opt', 'Single')
} else {
vars.put('Opt', 'double')
}
def size = com.jayway.jsonpath.JsonPath.read(prev.getResponseDataAsString(),
'$.options_available')
if (size == []) {
vars.put('size', 'NonConfigurable')
} else {
vars.put('size', 'Configurable')
}
if count ==1 , then control should be Configurable -> Single Controller if count==2 , then control should be Configurable -> Double Controller
How to implement the above case with nested Switch controller in Jmeter ? Help is useful.
Upvotes: 1
Views: 855
Reputation: 168197
Sounds like a single Switch Controller should be enough, just use ${Opt}-${size}
as "Switch Value" and create the following switch branches:
Also be aware that if certain actions assume shared test elements which are applicable for > 1 switch branch you can consider using Module Controller to avoid code duplication.
Upvotes: 2