A Java Pro article "Discover Your Inner Classes" by Harris W. Kirk ( http://www.fawcette.com/javapro/2002_01/magazine/features/hkirk/default.asp ) proposes a simple way of setting up Junit tests that are especially convenient when you need many test cases for a certain method.
The interesting about this article is that it seems like the suggested approach is very well suited for semi-automated test generation. The tests created this way may not cover everything you need all the time, but they should provide a good start, and you still have the option to customize to your liking. I suggest Idea uses this approach to generate Junit test skeletons: (Note that names refer to sample code in the article above) - In Project Properties, set "Testpath" to the location of your test source files (compare to Sourcepath). I'm assuming tests for x.y.z.MyClass will be defined in z.y.z.TestMyClass (same package by different file location). - When editing a source file select "Code - Create Test" to bring up a dialog much like "Overide Methods", or right click in the code and select "Create Test for this method" - let's say it's named thisMethod(...) . - A test class is created (or appended if it exists) similar to the example in the article. The test class has a "testThisMethod" method (naming convention should of course be configurable), that includes an Inner Class with members to match the method signature of thisMethod(...). The test class also has an overridden toString() method, a default implementation of executeTest(), and an empty TestSpec array (or maybe it should have one default element with empty Strings, nulls, and 0s?). The failedTests ArrayList, as well as the assert can also be included in the test skeleton. - Now all the developer has to do is add a few instances to the TestSpec array. - A "Go to"-"tested method" / "Go to"-"test for method" provides easy navigation between a class/method and it's corresponding test. And then he can run them from the existing "Run"-"Junit Tests" command. // Per Mellqvist _______________________________________________ Eap-features mailing list [EMAIL PROTECTED] http://www.intellij.com/mailman/listinfo/eap-features
