Author: lfryc(a)redhat.com
Date: 2010-07-10 17:08:41 -0400 (Sat, 10 Jul 2010)
New Revision: 17900
Modified:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java
Log:
Added logging for PollTestCase; added assertion on maximum particular deviation
Modified:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java
===================================================================
---
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java 2010-07-10
21:08:15 UTC (rev 17899)
+++
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java 2010-07-10
21:08:41 UTC (rev 17900)
@@ -34,6 +34,7 @@
import static org.testng.Assert.*;
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.*;
import static org.jboss.test.selenium.SystemProperties.isSeleniumDebug;
+import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
@@ -41,6 +42,9 @@
*/
public class PollTestCase extends AbstractTestappTestCase {
+ private final static int MAX_DEVIATION = 250;
+ private final static int MAX_AVERAGE_DEVIATION = 100;
+
ElementLocator attributeEnabled = id("form:attributes:enabledInput");
ElementLocator attributeInterval = id("form:attributes:intervalInput");
JQueryLocator time = pjq("span[id$=time]");
@@ -73,7 +77,11 @@
if (isSeleniumDebug()) {
System.out.println(time);
}
- total += Math.abs(interval - Math.abs(time));
+ long deviation = Math.abs(interval - Math.abs(time));
+ assertTrue(deviation <= MAX_DEVIATION, format(
+ "Particular deviation ({2}) for interval {0} was greater
than {1}", interval, MAX_DEVIATION,
+ deviation));
+ total += deviation;
count += 1;
}
}
@@ -85,9 +93,11 @@
if (isSeleniumDebug()) {
System.out.println(total / count);
}
- // asserts that average deviation is not greater than 100
- assertTrue((total / count) <= 100);
+ long averageDeviation = (total / count);
+ assertTrue(averageDeviation <= MAX_AVERAGE_DEVIATION, format(
+ "Average deviation ({1}) was greater than given maximum {0}",
MAX_AVERAGE_DEVIATION, averageDeviation));
+
}
}
Show replies by date