Created attachment 27642 [details] Test Plan that reproduces the issue Hello, Issue seen by deepak. Per the documentation: "The counter generates a new number each time it is called, starting with 1 and incrementing by +1 each time." However ThreadGroup +${__counter(TRUE,ref)}HTTPSampler1 +DebugSampler +${__counter(TRUE,ref)}HTTPSampler2 +DebugSampler +View Results tree Generates the number 1 in both cases.
Hello, I confirm this issue on 2.5 and 2.5.1. Analyzing it, issue is due to the fact that if you have 2 __counter with same ref, you will have 2 instances of CounterConfig. As perTheadNumber is not static, 2 counters will be incremented separately. So either it's a feature then documentation should be fixed Either it's a real issue, but fix can impact existing scenarios that excpect this behaviour. Regards Philippe
(In reply to comment #1) > Hello, > I confirm this issue on 2.5 and 2.5.1. > > Analyzing it, issue is due to the fact that if you have 2 __counter with same > ref, you will have 2 instances of CounterConfig. > Error : 2 instances of IterationCounter > As perTheadNumber is not static, 2 counters will be incremented separately. > But making it static is not the fix. > So either it's a feature then documentation should be fixed > Either it's a real issue, but fix can impact existing scenarios that excpect > this behaviour. > I think it's a feature > Regards > Philippe
Created attachment 27650 [details] Patch to function documentation
The docn already says: >>> The counter function instances are now completely independent. [JMeter 2.1.1 and earlier used a fixed thread variable to keep track of the per-user count, so multiple counter functions operated on the same value.] The global counter - "FALSE" - is separately maintained by each counter instance. <<< If anything needs to be clarified, it is that paragraph.
Created attachment 27651 [details] Patch to documentation
Created attachment 27652 [details] Simplified test case Here is a simplified test case using Java samplers instead of HTTP. Also included is a PreProcessor that updates the COUNT variable for every sample in the thread
URL: http://svn.apache.org/viewvc?rev=1178883&view=rev Log: Bug 51923 - Counter function bug or documentation issue ? (fixed docs) Modified: jakarta/jmeter/trunk/xdocs/changes.xml jakarta/jmeter/trunk/xdocs/usermanual/functions.xml
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2571