diff options
author | Jake Slack <jaslack@google.com> | 2014-04-04 11:51:12 -0700 |
---|---|---|
committer | Jake Slack <jaslack@google.com> | 2014-04-04 11:51:12 -0700 |
commit | 39d9aef13dbc9acf2be30b3db734c561f97626a4 (patch) | |
tree | 12a01912aa98ec699fc4d48b91c6a94ba0082104 /src | |
parent | b91b93ad4787c19d769d0e8f3c1660231d6e0687 (diff) | |
download | droiddriver-39d9aef13dbc9acf2be30b3db734c561f97626a4.tar.gz |
Resetting test state after a failed flaky test.
Currently, we do not tear down and re-setup a flaky test on the next
attempt. This means, if part of the test puts the app in some state that
is not expected at the beginning of the test, the test will fail.
Change-Id: Ie1caeb9505c490536add60da88409b66b939c4cf
Diffstat (limited to 'src')
-rw-r--r-- | src/com/google/android/droiddriver/helpers/BaseDroidDriverTest.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/com/google/android/droiddriver/helpers/BaseDroidDriverTest.java b/src/com/google/android/droiddriver/helpers/BaseDroidDriverTest.java index 3725bbd..3ce5030 100644 --- a/src/com/google/android/droiddriver/helpers/BaseDroidDriverTest.java +++ b/src/com/google/android/droiddriver/helpers/BaseDroidDriverTest.java @@ -191,6 +191,8 @@ public abstract class BaseDroidDriverTest<T extends Activity> extends /** * Overrides super.runTest() to fail fast when the test is annotated as * FlakyTest and we should skip remaining tests (the failure is fatal). + * When a flaky test is re-run, tearDown() and setUp() are called first in order + * to reset the test's state. */ @Override protected void runTest() throws Throwable { @@ -219,6 +221,9 @@ public abstract class BaseDroidDriverTest<T extends Activity> extends for (int runCount = 0; runCount < tolerance; runCount++) { if (runCount > 0) { Logs.logfmt(Log.INFO, "Running %s round %d of %d attempts", fName, runCount + 1, tolerance); + // We are re-attempting a test, so reset all state. + tearDown(); + setUp(); } try { |