Summary: | Loop nested in IF behaves erraticly | ||
---|---|---|---|
Product: | JMeter - Now in Github | Reporter: | Jim Donnellan <jdonnellan> |
Component: | Main | Assignee: | JMeter issues mailing list <issues> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | 2.2 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Linux | ||
Attachments: |
Suggested patch
Test plan which exposed the bug as described in the bug report |
Description
Jim Donnellan
2007-02-14 08:35:43 UTC
Created attachment 20171 [details]
Suggested patch
The reason for the observed behaviour, is that currently, the condition on the
"if controller" is evaluated for each sample / loop iteration INSIDE the if
controller.
I think that is incorrect. I think the "if controller" should only evaluate
its' condition when the "if block" is entered, and if the condition is
evaluated to true, then all the samplers and controllers inside the "if block"
should be executed.
The suggested patch also contains a minor change to ThreadGroupGui, which sets
the name of the LoopController for the ThreadGroup, so that it is easier to
debug which controllers are executed. This change is not needed to fix this
bug, so if you do not like it, then just drop that part.
Created attachment 20172 [details]
Test plan which exposed the bug as described in the bug report
(In reply to comment #1) > Created an attachment (id=20171) [edit] > Suggested patch > > The reason for the observed behaviour, is that currently, the condition on the > "if controller" is evaluated for each sample / loop iteration INSIDE the if > controller. > > I think that is incorrect. I think the "if controller" should only evaluate > its' condition when the "if block" is entered, and if the condition is > evaluated to true, then all the samplers and controllers inside the "if block" > should be executed. > > The suggested patch also contains a minor change to ThreadGroupGui, which sets > the name of the LoopController for the ThreadGroup, so that it is easier to > debug which controllers are executed. This change is not needed to fix this > bug, so if you do not like it, then just drop that part. After thinking about it a bit more, I think I need to test having an IF controller inside a Loop. I'm not sure that the current suggested patch, with the "isFirst()" test is correct. (In reply to comment #3) > > After thinking about it a bit more, I think I need to test having an IF > controller inside a Loop. I'm not sure that the current suggested patch, with > the "isFirst()" test is correct. I have tested more, and the suggested patch seems to be correct. Patch applied (apart from GUI change) - fixed in SVN r551743. This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/1864 |