Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 313467

Summary: [JUnit] Old method name is kept in launch config after changing the test class
Product: [Eclipse Project] JDT Reporter: Meng Xin Zhu <kane.zhu>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: curtis.windatt.public, daniel_megert, kane.mx, markus.kell.r
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

Description Meng Xin Zhu CLA 2010-05-19 03:02:51 EDT
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.
Comment 1 Curtis Windatt CLA 2010-05-19 09:50:03 EDT
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.
Comment 2 Markus Keller CLA 2010-06-04 10:11:52 EDT
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 ;-)