if-else block in JMeter -


i expect 2 possible cases in application: search successful , search failed. in both cases have 2 different sets of http requests, jmeter should execute. how can implement if-else block in jmeter scenario? i've tried use if controller regular expression extractor, relying on results of debug sampler, kind of extractors doesn't attached current thread. hence, 1 thread can override result of thread. bug or feature? there workarounds?

my regular expression extractor: extractor

my first if controller:

first if controller

my second if controller: enter image description here

order of execution:
order

always fires first controller , never second. when customer search failed, page not contains word "daniel" , expect ${customer_name} 0 length. moreover, debug sampler returns customer_name filled value after unsuccessful search. looks other thread overrides , extractor not thread safe.

your second condition flaky.

for instance have ${foo} variable. if not set, it's value ${foo} (surprisingly) , it's length 6.

so if there no match "${customer_name}".length value 16.

i suggest changing 2nd if controller condition like:

${__javascript(vars.get('customer_name')==null,)} 

and should work way. (you need use __javascript() function access vars object shorthand jmetervariables instance)

another option marking sampler failed in case of "daniel" not found , use ${jmeterthread.last_sample_ok} variable value condition.

see how use jmeter's 'if' controller , pie. guide if controller tips , tricks.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -