When creating an expression in an If Controller the expression is being evaluated to false when the last line is an empty one. Tested with "Interpret condition as variable expression" checked. e.g. 1. ${__jexl3(${blnChangeRadius} == 1)} Evaluates to true if blnChangeRadius == 1 1. ${__jexl3(${blnChangeRadius} == 1)} 2. Evaluates to false when blnChangeRadius == 1 blnChangeRadius in my case was just a random generated number (min:0 max:1)
Created attachment 36368 [details] trim expression before evaluation The attached patch fixes the reported behavior. The evaluated expression was "true\n" which got compared to "true" which resulted in false. I haven't committed the patch yet, as I wanted to add a test case so that we would not stumble upon this bug again, but it seems that the expression (condition) is not evaluated at all with my setup. Is anyone willing to tell me, what is missing there?
(In reply to Felix Schumacher from comment #1) > Created attachment 36368 [details] > trim expression before evaluation > > The attached patch fixes the reported behavior. The evaluated expression was > "true\n" which got compared to "true" which resulted in false. > > I haven't committed the patch yet, as I wanted to add a test case so that we > would not stumble upon this bug again, but it seems that the expression > (condition) is not evaluated at all with my setup. Is anyone willing to tell > me, what is missing there? You need to call ValueReplacer : JMeterContextService.getContext().setVariables(vars); JMeterContextService.getContext().setSamplingStarted(true); ValueReplacer replacer = new ValueReplacer(); replacer.setUserDefinedVariables(testPlan.getUserDefinedVariables()); Still it doesn't work with function and variable. Something to be investigated I guess.
Thanks for the report. This will be fixed in version 5.1. It would be nice, if you could test the next nightly and report, if it works for you. @pmouawad I implemented a simpler version of the test, that didn't need any variable expansion at all. Date: Tue Jan 8 17:30:48 2019 New Revision: 1850776 URL: http://svn.apache.org/viewvc?rev=1850776&view=rev Log: Ignore spaces at the end and beginning of expressions used in IfController Bugzilla Id: 63064 Modified: jmeter/trunk/src/core/org/apache/jmeter/control/IfController.java jmeter/trunk/test/src/org/apache/jmeter/control/TestIfController.java jmeter/trunk/xdocs/changes.xml
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/4972