Revision: 6655 Author: rj...@google.com Date: Wed Nov 4 11:43:21 2009 Log: Introduces JUnitShell argument -testMethodTimeout
Reviewed by amitmanjhi http://code.google.com/p/google-web-toolkit/source/detail?r=6655 Modified: /trunk/user/src/com/google/gwt/junit/JUnitShell.java ======================================= --- /trunk/user/src/com/google/gwt/junit/JUnitShell.java Wed Nov 4 08:32:00 2009 +++ /trunk/user/src/com/google/gwt/junit/JUnitShell.java Wed Nov 4 11:43:21 2009 @@ -41,6 +41,7 @@ import com.google.gwt.junit.client.impl.JUnitResult; import com.google.gwt.junit.client.impl.JUnitHost.TestInfo; import com.google.gwt.util.tools.ArgHandlerFlag; +import com.google.gwt.util.tools.ArgHandlerInt; import com.google.gwt.util.tools.ArgHandlerString; import junit.framework.AssertionFailedError; @@ -106,7 +107,6 @@ void processResult(TestCase testCase, JUnitResult result); } - @SuppressWarnings("deprecation") class ArgProcessor extends GWTShell.ArgProcessor { public ArgProcessor() { @@ -179,6 +179,38 @@ } }); + registerHandler(new ArgHandlerInt() { + @Override + public String[] getDefaultArgs() { + return new String[] {getTag(), "5"}; + } + + @Override + public String getPurpose() { + return "Set the test method timeout, in minutes"; + } + + @Override + public String getTag() { + return "-testMethodTimeout"; + } + + @Override + public String[] getTagArgs() { + return new String[] {"minutes"}; + } + + @Override + public boolean isUndocumented() { + return false; + } + + @Override + public void setInt(int minutes) { + baseTestMethodTimeoutMillis = minutes * 60 * 1000; + } + }); + registerHandler(new ArgHandlerString() { @Override public String getPurpose() { @@ -359,13 +391,6 @@ */ private static final String PROP_GWT_ARGS = "gwt.args"; - /** - * 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). default of 5 minutes. - */ - private static final long TEST_METHOD_TIMEOUT_MILLIS = 5 * 60 * 1000; - /** * Singleton object for hosting unit tests. All test case instances executed * by the TestRunner will use the single unitTestShell. @@ -563,9 +588,16 @@ private BatchingStrategy batchingStrategy = new NoBatchingStrategy(); /** - * Timeout in presence of batching. reassigned later. + * 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). Set by the -testMethodTimeout argument. */ - private long testBatchingMethodTimeoutMillis = TEST_METHOD_TIMEOUT_MILLIS; + private long baseTestMethodTimeoutMillis; + + /** + * Test method timeout as modified by the batching strategy. + */ + private long testBatchingMethodTimeoutMillis; /** * Determines how modules are compiled. @@ -953,7 +985,7 @@ throws UnableToCompleteException { testBatchingMethodTimeoutMillis = batchingStrategy.getTimeoutMultiplier() - * TEST_METHOD_TIMEOUT_MILLIS; + * baseTestMethodTimeoutMillis; if (mustNotExecuteTest(getBannedPlatforms(testCase.getClass(), testCase.getName()))) { return; --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---