You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2017/02/11 08:48:01 UTC
svn commit: r1782557 -
/jmeter/trunk/test/src/org/apache/jmeter/timers/ConstantThroughputTimerTest.java
Author: pmouawad
Date: Sat Feb 11 08:48:01 2017
New Revision: 1782557
URL: http://svn.apache.org/viewvc?rev=1782557&view=rev
Log:
Add docs
Modified:
jmeter/trunk/test/src/org/apache/jmeter/timers/ConstantThroughputTimerTest.java
Modified: jmeter/trunk/test/src/org/apache/jmeter/timers/ConstantThroughputTimerTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/timers/ConstantThroughputTimerTest.java?rev=1782557&r1=1782556&r2=1782557&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/timers/ConstantThroughputTimerTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/timers/ConstantThroughputTimerTest.java Sat Feb 11 08:48:01 2017
@@ -42,10 +42,18 @@ public class ConstantThroughputTimerTest
long start = System.currentTimeMillis();
long delay = timer.delay(); // Initialise
assertEquals(0,delay);
+ // The test tries to check if the calculated delay is correct.
+ // If the build machine is busy, then the sleep(500) may take longer in
+ // which case the calculated delay should be shorter.
+ // Since the test aims at 1 per second, the delay should be 1000 - elapsed.
+ // The test currently assumes elapsed is 500.
+
Thread.sleep(500);
long elapsed = System.currentTimeMillis() - start;
long expected = 1000-elapsed; // 1 second less what has already elapsed
- if (expected < 0) expected = 0;
+ if (expected < 0) {
+ expected = 0;
+ }
assertEquals("Expected delay of approx 500", expected, timer.delay(), 50);
}