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 152741 - [65cat] Run JUnit test class fails
Summary: [65cat] Run JUnit test class fails
Status: RESOLVED DUPLICATE of bug 158812
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker with 1 vote (vote)
Assignee: Milos Kleint
URL:
Keywords:
: 164386 164910 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-11-07 22:27 UTC by ulfzibis
Modified: 2009-05-28 12:14 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Oops, sorry. Here it is... (18.54 KB, image/jpeg)
2008-11-08 20:57 UTC, ulfzibis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ulfzibis 2008-11-07 22:27:40 UTC
[ BUILD # : 200811071401 ]
[ JDK VERSION : 1.5.* ]

JDK 1.5.0_u10

I just right-clicked on the test class in Project's node to "Run"
this test, but failed. See attachment...

This worked fine in RC2 and before, from where I have copied userdir.

Before I had patched this version according Issue 15009.
Comment 1 Lukas Hasik 2008-11-08 20:00:47 UTC
ulf, where is the attachment?
Comment 2 ulfzibis 2008-11-08 20:57:34 UTC
Created attachment 73550 [details]
Oops, sorry. Here it is...
Comment 3 Lukas Hasik 2008-11-08 21:42:30 UTC
reassigning, this has nothing to do with core. I cannot find however it seems as duplicate of existing report.
Comment 4 Tomas Zezula 2008-11-10 09:54:48 UTC
Milos did some changes in running main methods in tests in 7.0.
Comment 5 Milos Kleint 2008-11-10 09:58:51 UTC
yes, run file now means run a java file with "main()" method.
if you want to run the test as test, execute the Test File method (either on the test class itself, or it's associated
java file in sources)

I guess we need to do some additional checks and warnings, so that people get aware of the change in semantics
Comment 6 ulfzibis 2008-11-10 10:21:51 UTC
Thanks for this information.

I think, that is a good change:
- Run means run main()
- Test means run JUnit runner or anything similar
Maybe, it would be helpful, if "Run" would become disabled, if there is no main(), and "Test" would become disabled, if
there is no test.

I not have build 200811071401 installed anymore, so is it for sure, that there is "Test" in context menu of node in
project browser and of Editor. Maybe I had overseen this, I only found "Test" in top "Run" menu.
In this context, please also note issues 57704, 141735.
Comment 7 ulfzibis 2008-11-10 10:31:26 UTC
Maybe a tooltip on disabled "Run": "There in no main() in this class, maybe you can invoke "Test".
Comment 8 tomwheeler 2009-03-26 17:12:37 UTC
I experienced the same problem using the most recent JavaSE build pulled from the Hudson server.  My error message was
slightly different (Class "Null" does not have a main method.) even though my class had a legal class name and was in a
non-default package.

It did work for me to use "Test File" instead of "Run File" so I guess I'd call this a usability problem.  Previous
versions of the IDE did not have a "Test File" menu item on a the class' context menu (for platform projects anyway), so
I did not think to look for it and did not even notice it until I found this issue.  I would agree with ulfzibis that
disabling run (since there is no main method) and adding a tooltip that refers the user to use "Test File" instead would
be a reasonable approach.
Comment 9 Milos Kleint 2009-04-27 12:44:15 UTC
disabling run is not really possible. To figure if class has a main method, one has to query the java subsystem which
can hang the processign for a while. If invoked during "Scanning", the while can be pretty long.
Comment 10 Milos Kleint 2009-05-05 07:27:24 UTC
*** Issue 164386 has been marked as a duplicate of this issue. ***
Comment 11 Milos Kleint 2009-05-12 09:09:02 UTC
*** Issue 164910 has been marked as a duplicate of this issue. ***
Comment 12 rmichalsky 2009-05-28 12:14:40 UTC
Closely related to issue #158812 and issue #158904, should be resolved when these are fixed.

*** This issue has been marked as a duplicate of 158812 ***