Revision: 6523 Author: amitman...@google.com Date: Wed Oct 28 13:37:33 2009 Log: Adjust test timeout value based on Batching Strategy.
Patch by: amitmanjhi Review by: jlabanca http://code.google.com/p/google-web-toolkit/source/detail?r=6523 Modified: /trunk/user/src/com/google/gwt/junit/BatchingStrategy.java /trunk/user/src/com/google/gwt/junit/JUnitShell.java ======================================= --- /trunk/user/src/com/google/gwt/junit/BatchingStrategy.java Wed Oct 28 09:10:53 2009 +++ /trunk/user/src/com/google/gwt/junit/BatchingStrategy.java Wed Oct 28 13:37:33 2009 @@ -71,6 +71,15 @@ 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 @@ public boolean isSingleTestOnly() { return false; } + + @Override + protected int getTimeoutMultiplier() { + return 4; + } } /** @@ -151,4 +165,9 @@ public boolean isSingleTestOnly() { return false; } -} + + @Override + protected int getTimeoutMultiplier() { + return 4; + } +} ======================================= --- /trunk/user/src/com/google/gwt/junit/JUnitShell.java Wed Oct 28 09:58:30 2009 +++ /trunk/user/src/com/google/gwt/junit/JUnitShell.java Wed Oct 28 13:37:33 2009 @@ -330,9 +330,9 @@ /** * 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 @@ -529,6 +529,11 @@ * 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. @@ -729,13 +734,13 @@ */ 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"); @@ -915,6 +920,8 @@ 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 -~----------~----~----~----~------~----~------~--~---