summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/tb3
diff options
context:
space:
mode:
authorSauli Tähkäpää <sauli@vaadin.com>2014-10-04 21:25:47 +0300
committerVaadin Code Review <review@vaadin.com>2014-10-07 12:47:04 +0000
commit7d4884fab4b224c2cff88038ceed51cb554d575a (patch)
treec5f63a93abf34420f6b34eada00adf0c7f37b1d5 /uitest/src/com/vaadin/tests/tb3
parent3eede8ca8ac1db34400288f534a1088d301a7cee (diff)
downloadvaadin-framework-7d4884fab4b224c2cff88038ceed51cb554d575a.tar.gz
vaadin-framework-7d4884fab4b224c2cff88038ceed51cb554d575a.zip
Activated RetryOnFail on AbstractTB3Test.
Change-Id: I7d000593ba77f2edf7743775dbd8d7241c33e36a
Diffstat (limited to 'uitest/src/com/vaadin/tests/tb3')
-rw-r--r--uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java5
-rw-r--r--uitest/src/com/vaadin/tests/tb3/RetryOnFail.java24
-rw-r--r--uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java4
3 files changed, 19 insertions, 14 deletions
diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
index 1d03a7df76..76b851fd23 100644
--- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -40,6 +40,7 @@ import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicHttpEntityEnclosingRequest;
import org.junit.After;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.runner.RunWith;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
@@ -94,6 +95,10 @@ import elemental.json.impl.JsonUtil;
*/
@RunWith(value = TB3Runner.class)
public abstract class AbstractTB3Test extends TestBenchTestCase {
+
+ @Rule
+ public RetryOnFail retry = new RetryOnFail();
+
/**
* Height of the screenshots we want to capture
*/
diff --git a/uitest/src/com/vaadin/tests/tb3/RetryOnFail.java b/uitest/src/com/vaadin/tests/tb3/RetryOnFail.java
index 9c12147314..6fa6f9cd27 100644
--- a/uitest/src/com/vaadin/tests/tb3/RetryOnFail.java
+++ b/uitest/src/com/vaadin/tests/tb3/RetryOnFail.java
@@ -19,20 +19,7 @@ import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
-/**
- * <strong>ALWAYS</strong> declare the reason for using this test rule in a
- * test.
- *
- * <p>
- * Violators and abusers of this rule will be punished.
- * </p>
- *
- * @since 7.1.14
- * @author Vaadin Ltd
- */
public class RetryOnFail implements TestRule {
- private int retryCount = 1;
-
@Override
public Statement apply(Statement base, Description description) {
return statement(base, description);
@@ -44,6 +31,7 @@ public class RetryOnFail implements TestRule {
@Override
public void evaluate() throws Throwable {
Throwable caughtThrowable = null;
+ int retryCount = getRetryCount();
for (int i = 0; i <= retryCount; i++) {
try {
@@ -60,6 +48,16 @@ public class RetryOnFail implements TestRule {
}
throw caughtThrowable;
}
+
+ private int getRetryCount() {
+ String retryCount = System.getProperty("com.vaadin.testbench.max.retries");
+
+ if(retryCount != null && retryCount != "") {
+ return Integer.parseInt(retryCount);
+ }
+
+ return 4;
+ }
};
}
}
diff --git a/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java b/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java
index a99eea9bf6..ed5a2ed8aa 100644
--- a/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java
+++ b/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java
@@ -68,13 +68,15 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test {
* Contains a list of screenshot identifiers for which
* {@link #compareScreen(String)} has failed during the test
*/
- private List<String> screenshotFailures = new ArrayList<String>();
+ private List<String> screenshotFailures;
/**
* Defines TestBench screen comparison parameters before each test run
*/
@Before
public void setupScreenComparisonParameters() {
+ screenshotFailures = new ArrayList<String>();
+
Parameters.setScreenshotErrorDirectory(getScreenshotErrorDirectory());
Parameters
.setScreenshotReferenceDirectory(getScreenshotReferenceDirectory());