From: Timothy W. <tw...@oc...> - 2002-03-20 16:07:21
|
I'm preparing a script-based AWT/GUI tester for release, and there's an issue that's been bugging me for a while. When driving a GUI-based application, particularly one that has a lot of startup overhead, you want to run several test cases under the same instance of the application. Not a big deal, just wrap the suite in a TestDecorator or TestSetup. But ideally, when running from the script editor (or junit), you want to be able to run any given test case on its own. And from the script editor, you need to be able to invoke the setup and teardown at will, to facilitate browsing/exploring. So what's the best way to do this? I have one implementation that works, but I'm torn between defining a dedicated interface and reusing the existing TestDecorator pattern. Mostly I don't want to overload the TestDecorator pattern with additional meaning that might not be appropriate. The main issues are the following: 1) test cases run in isolation want to have the application under test run and torn down (run from junit harness, mostly). 2) some suites will want to have the application under test runn and torn down once for the complete set of test cases. 3) the script editor will want to do #1 and #2, in addition to launching and terminating the application under test arbitrarily. Spoilers below (If you want to contribute, respond first before reading the following): 1) For my AWTTestCase, I have a launch/terminate as part of the interface. The AWTTestSuite auto-generated suite enables launch on the first testcase and terminate on the last, disabling both for all other test cases run. If any test case is invoked in isolation, both launch and terminate are invoked (the default). While this method makes all the operations explicit, it ignores the established TestDecorator/TestSetup patterns. 2) AWTTestCase could provide an interface to return a custom TestDecorator/TestSetup class, so that they can be created on the fly as needed. AWTTestSuite can then use this to wrap a suite. The script editor can use it to invoke the setup/teardown methods separately. JUnit is still left handling the test cases raw, though. The test case can't really know to automatically conditionally wrap itself. |
From: Kent B. <ken...@cs...> - 2002-03-20 21:16:25
|
Re-running a single test wrapped in arbitrary TestDecorators does not work correctly in the current implementation. Nobody uses TestDecorators and/or re-run enough for this to be a problem in practice. Erich and I looked at the problem for half an hour and didn't find an elegant solution, so we left it on the books. Kent |