This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Test files from "Unit test packages" have "Run File" (Shift+F6) and "Debug File" (Ctrl-Shift-F5) actions which are useless. Choosing that action shows popup with message: Class "null" does not have a main method Test files should have actions "Run Test File" (Ctrl+F6) and "Debug Test File" (Ctrl-Shift-F6) Product Version = NetBeans IDE Dev (Build 090212) Operating System = SunOS version 5.10 running on x86 Java; VM; Vendor = 1.6.0_11; Java HotSpot(TM) Client VM 11.0-b16; Sun Microsystems Inc. Runtime = Java(TM) SE Runtime Environment 1.6.0_11-b03 Java Home = /usr/jdk/instances/jdk1.6.0_11/jre System Locale; Encoding = en_US (nb); UTF-8
some time ago it was possible to use run/debug actions from context menu for junit test files
The Run -> 'Test File' and Debug -> 'Debug Test File' actions work fine. You have to invoke them on the original class (not the test class). The 'Run File', 'Debug File' when invoked on the test class fail as you said. I'll investigate what's wrong.
OK, please disregard my last message, it's not entirely correct. The current behavior is as designed and as requested in issue #119922. To put it in words I'm copy-pasting jrojcek's description from #119922: --- Run File - runs the main method Test File - runs the selected test class or the associated test class for the selected regular class --- --- Debug File - debugs the main method Debug Test File - debugs the selected test class or the associated test class for the selected regular class --- And that's exactly how it works in current trunk. As a consequence of #119922 when a test class has no main method the Run/Debug actions show the dialog that you mentioned. I'm not sure why you got the 'null' in the message though. When I tried it it showed the name of the test class.
In the popup menu on a file's node there is a 'Test File' action, but no 'Debug Test File', which IMO is fine. You can use 'Debug Test File' from the main menu or use the shortcut. Product Version: NetBeans IDE Dev (Build 090212) Java: 1.5.0_14; Java HotSpot(TM) Client VM 1.5.0_14-b03 System: Linux version 2.6.22-16-generic running on i386; UTF-8; en_US (nb)
Vita, Please, advise what to do. Because I found it as real usability problem. I don't agree with such "by design" when JUnit test file has useless actions in context menu and doesn't have useful. Which IZ to reopen? I'd vote for removing useless "Run File", "Debug File" from context menu of JUnit test files and add useful "Test File" and "Debug Test File" instead
Hi Vladimir, I'm sorry that you have a problem with this. If you think the current state has major usability problems please escalate it on nbui (I think, CC Jano to be sure). I'd like to point out that Run/Debug actions on a test class are not useless. If the test class has the main method these actions will run/debug the class through this main method (as requested in #119922). Also there __is__ the 'Test File' action in the popup menu on test classes and it runs tests in the test class. And finally shortcuts for all four actions work. So the only thing that you are asking for and that is missing is the 'Debug Test File' action in the popup menu on test classes. If that is indeed what you want we could probably add it if UI folks agree. I'm leaving this opened as P3/future so that we can discuss it further.
Hi, Vita, You are right about "Test File" action, it's here, so I was not right. (so P3 is fine) And yes, I'd like to see "Debug Test File" action as well, because it's usual work flow in our group to fix problems by creating test and work with it in Debug mode. When 7.0 will be release and other developers from our group will miss "Debug" action in context menu they will complain :-) But it will be too late to fix
Absence of "Debug Test" action is clearly described in 158812. BTW, as an interim workaround in current dev builds you could use 'Debug' popup menu from test results window. *** This issue has been marked as a duplicate of 158812 ***