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.

Bug 158068 - Runing JUnit tests
Summary: Runing JUnit tests
Status: VERIFIED INVALID
Alias: None
Product: apisupport
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: rmichalsky
URL:
Keywords: UI, USABILITY
Depends on:
Blocks:
 
Reported: 2009-02-06 11:55 UTC by Petr Dvorak
Modified: 2009-02-19 20:18 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
NetBeans 6.5 (46.79 KB, image/png)
2009-02-06 13:42 UTC, Petr Dvorak
Details
NetBeans Dev (2008-Feb-06) (48.56 KB, image/png)
2009-02-06 13:42 UTC, Petr Dvorak
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Dvorak 2009-02-06 11:55:23 UTC
Product Version: NetBeans IDE Dev (Build 200902060201)
Java: 1.6.0_10; Java HotSpot(TM) Client VM 11.0-b15
System: Linux version 2.6.27-11-generic running on i386; UTF-8; en_US (nb)

I started ergonomic IDE with a fresh userdir, I tried to debug a test for editor module. But I noticed Run/Debug items
are disabled on JUnit test files in above mentioned build.

Note: I can invoke "test file" above this file which does exactly what "run" used to do... (and imo it is not correct -
test should be disabled above the file).
Comment 1 Andrey Yamkovoy 2009-02-06 12:50:18 UTC
First of all I don't know why these items are disabled on the test classes nodes because on the my local trunk build I
see these action enabled. Colud you please provide more details what project type you are using and what test you are
trying to run/debug(pls attach if possible). 
But anyway you can't run/debug test files if there is not main(String args[]) method in it. To debug such a tests you
need to select test file and invoke action "Debug Test File" from main menu "Debug" or by shortcut Ctrl+Shift+F6.
Comment 2 Petr Dvorak 2009-02-06 13:41:21 UTC
kaktus> Colud you please provide more details what project type you are using...
joshis> I tried to debug a test for editor module.

Project type is netbeans module (specifically, the Editor)...

> But anyway you can't run/debug test files if there is not main(String args[]) method in it.
> To debug such a tests you need to select test file and invoke action "Debug Test File" from
> main menu "Debug" or by shortcut Ctrl+Shift+F6.

Is it some UI change? The actions Run/Debug were available there and it was very convenient. See screenshots... It is
logical - I want to run/debug the file that is a JUnit test. This file only need to have a "suite" method.

What is there now:

- "Test File" - this action's name doesn't make sense, it suggests that test for the file will be launched. If this is
supposed to be the substitute for "Run File", it should be called "Run Test File".

What is missing:
- "Debug Test File" in the editor/projects context menu
Comment 3 Petr Dvorak 2009-02-06 13:42:02 UTC
Created attachment 76655 [details]
NetBeans 6.5
Comment 4 Petr Dvorak 2009-02-06 13:42:52 UTC
Created attachment 76656 [details]
NetBeans Dev (2008-Feb-06)
Comment 5 Petr Dvorak 2009-02-06 13:45:42 UTC
See http://wiki.netbeans.org/UIReviewProcess for details.
Comment 6 Andrey Yamkovoy 2009-02-06 15:04:07 UTC
So, on the my build Run/Debug actions are enabled for KeyMapSuite test class and works properly.
As for the UI changes I have not made any UI changes. I have just several days ago started to fix some JUnit issues.
Comment 7 Petr Dvorak 2009-02-06 15:25:46 UTC
This is really weird... I will try to build the IDE myself, maybe it was just a "bad build" (official trunk build though)?

Making incomplete until reporter manages to build the fresh IDE;)...
Comment 8 Petr Dvorak 2009-02-09 11:48:26 UTC
Product Version: NetBeans IDE Dev (Build 200902090201)
Java: 1.6.0_10; Java HotSpot(TM) Client VM 11.0-b15
System: Linux version 2.6.27-11-generic running on i386; UTF-8; en_US (nb)

The problem can be reproduced with a build from 20090209. To reproduce:

1. Start full (ergonomic) IDE with a fresh userdir (!!!)
2. Open "editor" module (NetBeans Module)
3. Invoke contextual menu above the file suggested on screenshot
-> run/debug is disabled
Comment 9 Andrey Yamkovoy 2009-02-09 14:25:24 UTC
So, as far as I found this regression was made by the fix for issue #154358.
Reassign to apisupport/project for evaluation.
Comment 10 rmichalsky 2009-02-10 09:39:48 UTC
This is a deliberate behavior, see issue #119922 with original proposal. Issue #154358 just made NBM projects consistent
with the proposal, Java and Maven projects already behave this way in 6.5.
Comment 11 Jesse Glick 2009-02-10 16:02:50 UTC
The lack of Debug Test [for File] in the context menu (only main menu / shortcut) is a minor functional regression that
should perhaps be filed in java.source?
Comment 12 Petr Dvorak 2009-02-10 16:03:44 UTC
OK, just a few notes to explain why I am reopening this issue (with different summary):

1. This is a UI change - it should have gone through the review process (see link above) and UI specification (also
above) should have been updated to reflect this behaviour.

2. There is no "debug test" in file's context menu - I have lost a convenient start point for debugging a JUnit test. I
have to use the main menu or a shortcut, which is not so nice as the invocation from the context menu (when I invoke the
context menu above a file, I know the action is really invoked for the file I want).

3. I cannot run/debug a normal test (AND THIS IS WHAT YOU DO IN 99%!!!!) from the editor's context menu as there is no
item for it - but if the test by the accident had a main method (for some probably very clever reason), I can run it...
cool...

4. A little bit of linguistic jam... What is the logic behind this: "Test file" invoked above a JUnit test class runs
the test... ? IMO "Test file" invoked above JUnit test should run the test for that test. "Run Test" would make much
better sense than "Test File"... "Test file" makes more sense above the class it is supposed to test => please at least
change the actions name to "Run Test" and "Debug Test" (and update UI spec accordingly).

So basically: we introduced several PITA issues (2,3) just because we wanted to allow someone to run main method from
the file that is technically a JUnit test... ??? Now I will be maybe little stupid: What is a ratio behind having a
JUnit test as a main class anyway??
Comment 13 rmichalsky 2009-02-10 16:26:28 UTC
As the saying goes, you are crying nicely, but on the wrong grave :). I also agree with points 2.-4. (and don't
understand the importance of running main method in test class either), but this change merely made NBM projects
consistent with other project types (including missing context menu actions). 

So if you want to have this changed, please reopen original issue #119922 instead, which is an umbrella for all types of
projects and for which, I believe, UI review has been done. 
Comment 14 Petr Dvorak 2009-02-10 16:53:42 UTC
OK, thanks Richard. ;)