jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1783795 - /jmeter/trunk/test/src/org/apache/jmeter/timers/ConstantThroughputTimerTest.java
Date Mon, 20 Feb 2017 20:29:09 GMT
Author: pmouawad
Date: Mon Feb 20 20:29:09 2017
New Revision: 1783795

URL: http://svn.apache.org/viewvc?rev=1783795&view=rev
Log:
Add tests for ConstantTimer and UniformRandomTimer

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=1783795&r1=1783794&r2=1783795&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/timers/ConstantThroughputTimerTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/timers/ConstantThroughputTimerTest.java Mon Feb
20 20:29:09 2017
@@ -26,6 +26,7 @@ import org.apache.jmeter.threads.JMeterC
 import org.apache.jmeter.threads.TestJMeterContextService;
 import org.apache.jmeter.util.BeanShellInterpreter;
 import org.apache.jmeter.util.ScriptingTestElement;
+import org.junit.Assert;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -122,5 +123,23 @@ public class ConstantThroughputTimerTest
         timer.setScript("5*3*4");
         assertEquals(60,timer.delay());
     }
+    
+    @Test
+    public void testUniformRandomTimer() throws Exception {
+        UniformRandomTimer timer = new UniformRandomTimer();
+        timer.setDelay("1000");
+        timer.setRange(100d);
+        timer.iterationStart(null);
+        long delay = timer.delay();
+        Assert.assertTrue("delay:"+delay +" is not in expected range", delay >= 1000 &&
delay <=1100);
+    }
+    
+    @Test
+    public void testConstantTimer() throws Exception {
+        ConstantTimer timer = new ConstantTimer();
+        timer.setDelay("1000");
+        timer.iterationStart(null);
+        assertEquals(1000, timer.delay());
+    }
 
 }



Mime
View raw message