Background: ========= Currently, Junit tests and module compilations run synchronously as follows: 1. Compile the first module 2. Run tests in first module 3. Compile second module 4. Run tests in second module 5. Continue through all modules
Since running tests can be time consuming but requires very little CPU, I'd like to compile future modules while tests are running. That is: 1. Compile the first module 2. Run tests in first module while compiling second module 3. Run tests in second module while compiling third module 4. Continue through all modules This has two advantages. First, it parallelizes test runs and compiles, allowing the tests to run a little faster. Second, by pre-compiling all modules, we don't have to synchronize remote clients, which means faster clients can run to completion before other remote clients connect. For example, if you have 5 test systems running selenium or BrowerManager, the first system can run the tests and return immediately before the other 4 connect, which has some advantages in terms of reducing usage of test machines. Without this change, the first system has to wait for all systems to sync up before running the next module. API Change: ========= The problem is that JUnitShell creates a synthetic module name based on the JUnitStrategy.Strategy that is passed into JunitShell#runTest() when the test is run, which means we can't compile the next test module until the next test starts because we don't know the synthetic module name. I propose that we add the method GWTTestCase#getStrategy() that will be used when we populate GWTTestCase#ALL_GWT_TESTS. Currently, we assume the synthetic module name just adds ".JUnit" to the module name, which is true for almost all GWT test cases. However, test cases that extend Benchmark use a different strategy and a differnet synthetic module extension. Presumably, other developers may be doing something similar. By adding the following method to GWTTestCase, we can use the correct synthetic module name when grouping test cases together in GWTTestCase#ALL_GWT_TESTS. public JUnitShell.Strategy getStrategy() GWTTestCase will return JUnitShell.JUnitStrategy (which will be made public and final). Benchmark, the only class that uses a different strategy in the GWT codebase, will return a private inner class called BenchmarkStrategy. GWTTestCase#runTest() will pass the strategy into JUnitShell.runTest() instead of letting JUnitShell use the default one. Who this affects: ============ This change affects a very small set of developers who actually override GWTTestCase#runTest() and manually call JUnitShell with a strategy option. They will need to ensure that their test case returns the correct strategy, or it won't run as part of the correct synthetic module. Deprecation and further changes: ========================= Since JUnitShell is meant for use with GWTTestCases, I also propose the following to avoid a situation where the return value of GWTTestCase#getStrategy() does not equal the strategy passed into JUnitShell#runTest(). The following methods will be deprecated: JUnitShell#runTest(String moduleName, TestCase testCase, TestResult testResult) JUnitShell#runTest(String moduleName, TestCase testCase, TestResult testResult, Strategy strategy) And this will be added: JUnitShell#runTest(String moduleName, GWTTestCase testCase, TestResult testResult) Since GWTTestCase will provide the strategy, we no longer need to pass it in. Thanks, John LaBanca [email protected] --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
