Bug 32920 - If Controller check not working properly
Summary: If Controller check not working properly
Status: RESOLVED DUPLICATE of bug 32790
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.0.2
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-03 15:58 UTC by Atul Verma
Modified: 2005-03-11 18:29 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Atul Verma 2005-01-03 15:58:40 UTC
I am trying to create a Test Script using JMeter 2.0.2, in which I have a Http 
Request from which I'm extracting a phrase, that is stored in a variable say 
errVar. In the If controller I need to check for the contents of this variable 
with a String value say word1.word2.word3. I'm providing the If controller the 
condition in Javascript Style like ${errVar}=='word1.word2.word3'.

I have also tried out all options like, using double quotes in the 
string "word1.word2.word3", removing all the quotes, either single or double. 
Using the variable without $ and {}, using single equla to sign, but nothing 
seems to work. Please suggest ASAP.

Regards
AV
Comment 1 Sebb 2005-01-03 16:54:01 UTC
Are there any errors in the jmeter.log file?

You probably need to quote both sides of the comparison, e.g.

'${errVar}'=='word1.word2.word3'

What happens if you replace == with != - does it then work?

If neither == nor != works, then the JavaScript must be invalid.

Comment 2 Atul Verma 2005-01-03 17:00:30 UTC
It Worked, but initially I was trying to get all the patterns in the form say 
name="word1.word2.word3". So it gave all the patterns, as I checked by putting 
a HTTP Request object below a For Each Controller. But the If controller is 
not working below the For Each Controller. So Now I have to find the exact 
number of the Pattern Match that comes out to be some number every time, say 
6. This is a workarount at this moment but I actually need to find it out from 
a group of extracted, values.

Please suggest on that. Hope U understand the problem I'm facing.

Regards
AV
Comment 3 Dennis Todd 2005-01-12 02:53:28 UTC
I have a similiar problem. I was using the IfController after a ForEach
controller. When I use the recommended syntax '${returnFoo}'=='Software' in a
list of 6 elements starting with 'Software' the IF claims to find 'Software' in
all 6 elements. It is a substring in one, but not all. "returnFoo" is the output
variable from ForEach. If I use any other element from the ForEach list, it
never finds it. I know returnFoo is being set with each element in the ForEach
List. I have set it in another HTTP request and seen the output. So it appears
as if there is a problem in the comparison.

I tried the COUNT example, that works ok.

Regards,

Dennis Todd
Hewlett Packard
Comment 4 Sebb 2005-03-12 03:29:45 UTC
This appears to be the same as 32790 - condition not being re-evaluated

*** This bug has been marked as a duplicate of 32790 ***
Comment 5 The ASF infrastructure team 2022-09-24 20:37:34 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/1487