You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Noel O'Brien <no...@newbay.com> on 2009/04/09 13:41:48 UTC

Bug in Loop Controller??

Hi All,

I've found some unusual behavior when I use a loop controller inside a for 
each controller. I think it may be a bug, but hopefully someone can explain 
why it's happening:

I can demonstrate it by using the following test plan:



thread group
	-User defined variables
	-ForEach Controller
		-Debug Sampler 1
		-Loop Controller
			-Debug Sampler 2
View Results Tree


User defined variables element contains the following values:
val_1	 	1
val_2	 	2
val_3	 	0
val_4	 	0
val_5	 	3
val_6	 	0
val_7	 	7
val_8	 	8

The basic objective of the test plan is: "for each `val`, loop that number of 
times"

ForEach Controller is configured:
Input Variable Prefix: val
Output Variable Name: this.val
Add '_' before number: yes

Loop Controller is configured:
Loop Count: ${this.val}
Forever: No

I expected this to produce the following sequence in the View Results tree:
Debug Sampler 1
Debug Sampler 2
Debug Sampler 1
Debug Sampler 2
Debug Sampler 2
Debug Sampler 1
Debug Sampler 1
Debug Sampler 1
Debug Sampler 2
Debug Sampler 2
Debug Sampler 2
Debug Sampler 1
Debug Sampler 1
Debug Sampler 2
Debug Sampler 2
Debug Sampler 2
Debug Sampler 2
Debug Sampler 2
Debug Sampler 2
Debug Sampler 2
Debug Sampler 1
Debug Sampler 2
Debug Sampler 2
Debug Sampler 2
Debug Sampler 2
Debug Sampler 2
Debug Sampler 2
Debug Sampler 2
Debug Sampler 2

but instead is produced the following results:
Debug Sampler 1
Debug Sampler 2
Debug Sampler 1
Debug Sampler 2
Debug Sampler 2
Debug Sampler 1
Debug Sampler 2
Debug Sampler 1
Debug Sampler 1
Debug Sampler 1
Debug Sampler 1
Debug Sampler 1

It's really weird, because in the first case where the loop controller will be 
0 (third iteration, val_3=0), Debug Sampler 2 is executed once, but it lists 
`this.val=0`, which is the correct value, but since it's 0, the loop 
controller should not have been entered at all, right? It seems too that once 
a loop controller has been executed with a value of 0, any subsequent 
iterations of the foreach controller which should enter the loop controller 
(i.e. iterations 5, 7, and 8 of the foreach) do not enter it.

Thoughts?

Regards,
Noel