Reviewers: jlabanca, Description: Simple patch to adjust timeout based on BatchingStrategy
Please review this at http://gwt-code-reviews.appspot.com/88808 Affected files: user/src/com/google/gwt/junit/BatchingStrategy.java user/src/com/google/gwt/junit/JUnitShell.java Index: user/src/com/google/gwt/junit/BatchingStrategy.java --- user/src/com/google/gwt/junit/BatchingStrategy.java (revision 6279) +++ user/src/com/google/gwt/junit/BatchingStrategy.java (working copy) @@ -71,6 +71,15 @@ public abstract class BatchingStrategy { toExecute.removeAll(toRemove); return toExecute; } + + /** + * Returns the multiplicative factor for adjusting the timeout. Default value + * of 1 for no batching. + */ + protected int getTimeoutMultiplier() { + return 1; + } + } /** @@ -130,6 +139,11 @@ class ClassBatchingStrategy extends BatchingStrategy { public boolean isSingleTestOnly() { return false; } + + @Override + protected int getTimeoutMultiplier() { + return 4; + } } /** @@ -151,4 +165,9 @@ class ModuleBatchingStrategy extends BatchingStrategy { public boolean isSingleTestOnly() { return false; } + + @Override + protected int getTimeoutMultiplier() { + return 4; + } } Index: user/src/com/google/gwt/junit/JUnitShell.java --- user/src/com/google/gwt/junit/JUnitShell.java (revision 6476) +++ user/src/com/google/gwt/junit/JUnitShell.java (working copy) @@ -331,9 +331,9 @@ public class JUnitShell extends GWTShell { /** * The amount of time to wait for all clients to complete a single test * method, in milliseconds, measured from when the <i>last</i> client connects - * (and thus starts the test). 20 minutes. + * (and thus starts the test). default of 5 minutes. */ - private static final long TEST_METHOD_TIMEOUT_MILLIS = 4 * 300000; + private static final long TEST_METHOD_TIMEOUT_MILLIS = 300000; /** * Singleton object for hosting unit tests. All test case instances executed @@ -527,6 +527,11 @@ public class JUnitShell extends GWTShell { * Determines how to batch up tests for execution. */ private BatchingStrategy batchingStrategy = new NoBatchingStrategy(); + + /** + * Timeout in presence of batching. reassigned later. + */ + private long testBatchingMethodTimeoutMillis = TEST_METHOD_TIMEOUT_MILLIS; /** * Determines how modules are compiled. @@ -738,13 +743,13 @@ public class JUnitShell extends GWTShell { */ lastModule = currentModule; if (testMethodTimeout == 0) { - testMethodTimeout = currentTimeMillis + TEST_METHOD_TIMEOUT_MILLIS; + testMethodTimeout = currentTimeMillis + testBatchingMethodTimeoutMillis; } else if (testMethodTimeout < currentTimeMillis) { double elapsed = (currentTimeMillis - testBeginTime) / 1000.0; throw new TimeoutException( "The browser did not complete the test method " + currentTestInfo.toString() + " in " - + TEST_METHOD_TIMEOUT_MILLIS + + testBatchingMethodTimeoutMillis + "ms.\n We have no results from:\n" + messageQueue.getWorkingClients(currentTestInfo) + "Actual time elapsed: " + elapsed + " seconds.\n"); @@ -931,6 +936,8 @@ public class JUnitShell extends GWTShell { private void runTestImpl(GWTTestCase testCase, TestResult testResult) throws UnableToCompleteException { + testBatchingMethodTimeoutMillis = batchingStrategy.getTimeoutMultiplier() + * TEST_METHOD_TIMEOUT_MILLIS; if (mustNotExecuteTest(getBannedPlatforms(testCase.getClass(), testCase.getName()))) { return; --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---