Community
Participate
Working Groups
Build Identifier: 3.6 I20100513-1500 Stale test method name is kept after changing the test class in JUnit Plug-in Test run configuration Reproducible: Always Steps to Reproduce: 1. create a new JUnit Plug-in Test 2. select one Test class said as TestClassA 3. select one test method of TestClassA, said as testMethodA 4. run test, it works ok 5. change Test class to TestClassB The test method still is testMethodA that doesn't exist in TestClassB. junit test would be failed if running it.
The UI you are modifying on the junit test tab is provided by JDT. Moving to them for comment. When I change the class, an error message is displayed in the launch configuration dialog "Can not find test method [foo] in project [bar]". However, the debug button is still enabled. Perhaps this tab should work similarly to the Java Application main tab which disables the debug button when main class is not specified.
That's actually by design. The "Test method" field in the launch configuration determines the "name" of the test. Since the JUnit nomenclature is quite fuzzy, and the default implementation of TestCase interprets the "name" as methods name, we've called the field "Test method" in the UI. Other implementations of TestCase can use the "name" in a different way, and that's why the Run/Debug button is not disabled, even when then test class does not contain a method with the given name. The UI shows an error message, and if you ignore that, it's your choice ;-)