Bug 158812 - Inconvenient debugging JUnit test since the fix of issue 158068 and 119922
Inconvenient debugging JUnit test since the fix of issue 158068 and 119922
Status: VERIFIED FIXED
Product: javaee
Classification: Unclassified
Component: Web Project
6.x
All All
: P3 with 1 vote (vote)
: 6.x
Assigned To: David Konecny
issues@javaee
67patch1-verified
:
: 152741 158455 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-02-19 12:58 UTC by Petr Dvorak
Modified: 2009-07-21 07:50 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
:


Attachments

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

See also my comments in issue 158068 (and 119922). This issue introduced some relatively visible inconveniences to the
workflow with the JUnit tests, summary follows:

-----------

- There is no "Debug test" item in file's context menu in the Project's view (previously, "debug file" did the job, but
now it just says there is no main method in the file)

- I cannot run/debug a normal test from the editor's context menu as there is no item for it (please add items for
debugging and running a JUnit test file to the editor's context menu), but there are items Run File/Debug file, that
usually just say there is no main class...

- I don't understand 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 (it should test the file). "Run Test"/"Debug Test"
would make much better sense than "Test File"/"Debug Test File"... "Test file" makes more sense above the class it is
supposed to test...

-----------

First two points are very inconvenient for me, because you cannot invoke an action that is associated with a file using
the file contextual menu (neither in the editor, nor in the Projects view), you must use a global action from the main menu.

Third point is a naming issue (actions name doesn't explain what the action does).
Comment 1 Max Sauer 2009-02-19 14:19:01 UTC
Imho, whole this UI change is completely wrong, we should have said that main-class driven test are not supported or make some new action for it. But 
since it seems that majority likes it I'll fix this one for 7.0.
Comment 2 Petr Dvorak 2009-02-19 15:03:12 UTC
msauer: My sentiments exactly... Users who are used to the current workflow will be pretty angry with this change...

> or make some new action for it

Yes, this would be much better solution, to add items to run/debug file as a java main class (only when the file has a
main class)...
Comment 3 t_h 2009-03-26 13:24:47 UTC
I agree with joshis that this change is significant regression in usability. At least Run/Debug file should fallback to
previous behavior if there is no main method.
Comment 4 rmichalsky 2009-03-31 09:23:03 UTC
> Run/Debug file should fallback to previous behavior if there is no main method

+1 on that. Not an ideal solution but definitely should be done in 6.7. Of course needs change in all Java project types
simultaneously.
Comment 5 Alexei Mokeev 2009-04-15 14:20:34 UTC
*** Issue 158455 has been marked as a duplicate of this issue. ***
Comment 6 Max Sauer 2009-04-28 13:58:16 UTC
I've introduced the requested fallback for j2seproject. Reassigning to web -- please adjust your code in a similar way so that this issue may be closed.
---
http://hg.netbeans.org/jet-main/rev/3e7cb430c1a0
Comment 7 Quality Engineering 2009-04-29 07:21:31 UTC
Integrated into 'main-golden', will be available in build *200904290201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/3e7cb430c1a0
User: Max Sauer <msauer@netbeans.org>
Log: #158812: Inconvenient debugging JUnit test since the fix of issue 158068 and 119922 -- fallback for j2seproject
Comment 8 Petr Dvorak 2009-05-28 11:53:22 UTC
Product Version: NetBeans IDE 6.7 RC1 (Build 200905280001)
Java: 1.6.0_13; Java HotSpot(TM) Client VM 11.3-b02
System: Linux version 2.6.28-11-generic running on i386; UTF-8; en_US (nb)

Not fixed for J2SE project. I have created a J2SE project (Java Application) with a simple JUnit test:

package maintain;
import junit.framework.TestCase;
public class DeleteProjects extends TestCase {
    @Override
    public void setUp() throws Exception {
    }
    public void testNew() throws Exception {
    }
}

I invoked Run/Debug above the rest file  (in editor):

> run:
> Exception in thread "main" java.lang.NoSuchMethodError: main
> Java Result: 1
> BUILD SUCCESSFUL (total time: 0 seconds)

> debug:
> Exception in thread "main" java.lang.NoSuchMethodError: main
> Java Result: 1
> BUILD SUCCESSFUL (total time: 2 seconds)

Is this issue really going to be in 6.7? I am tempted to push the priority because it is annoying.
Comment 9 rmichalsky 2009-05-28 12:11:14 UTC
> I've introduced the requested fallback for j2seproject. 

The same fallback is in apisupport projects as well, see issue #158904.
Comment 10 rmichalsky 2009-05-28 12:14:30 UTC
*** Issue 152741 has been marked as a duplicate of this issue. ***
Comment 11 Max Sauer 2009-05-28 12:50:12 UTC
@joshis : There is some additional problem with Compile-on-save -- if you turn it off, it will start to work. In case you think this has to be fixed, please 
discuss with Marian and open a new issue. Otherwise, I'll have a look for 6.8.
Comment 12 Max Sauer 2009-05-28 15:18:36 UTC
@joshis: I've fixed it for j2seproject with CoS also. Could you please verify? Thanks.
---
http://hg.netbeans.org/jet-main/rev/c3c22c4ddcde
Comment 13 Petr Dvorak 2009-05-28 15:22:46 UTC
I will as soon as it is in dailies. Thank you, msauer!
Comment 14 Quality Engineering 2009-05-29 08:22:00 UTC
Integrated into 'main-golden', will be available in build *200905290201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/c3c22c4ddcde
User: Max Sauer <msauer@netbeans.org>
Log: #158812: Fixing j2se with compile-on-save on
Comment 15 Petr Dvorak 2009-07-02 12:52:01 UTC
Is it possible to fix this in the 6.7 patch 1 (I mean the fix for J2SE)? Some users are complaining about this in
nbusers. Thank you...
Comment 16 Petr Jiricka 2009-07-02 17:47:13 UTC
It does not look like the patch is directly applicable to web project and other EE project types, the code looks quite
different. What do you think David?

Shouldn't the code that handles this be somehow shared among all the project types in java.api.common? It sounds like
there is nothing web-specific in this. At least some utility methods, or a common superclass for the ActionProviders...
Comment 17 David Konecny 2009-07-06 04:13:42 UTC
b00ed455a8f7

I implemented similar fallback to web project - if Run/Debug File is executed on a unit test which does not have main
method then instead of showing "no main class" dialog an attempt is made to execute file as unit test.
Comment 18 Quality Engineering 2009-07-07 05:31:49 UTC
Integrated into 'main-golden', will be available in build *200907070200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/b00ed455a8f7
User: David Konecny <dkonecny@netbeans.org>
Log: #158812 - fallback runSingle/debugSingle to run/debug single junit test if main() is not present
Comment 19 martin_zmrhal 2009-07-07 13:02:59 UTC
Verified in 200907070200
Comment 20 pgebauer 2009-07-09 14:12:46 UTC
The fix has been ported into the release67_fixes repository.
http://hg.netbeans.org/release67_fixes/rev/09c1ae22b500
Comment 21 Jindrich Sedek 2009-07-20 12:56:10 UTC
I've tried to verify in 6.7.1 RC build, but I'm facing a regression against 6.7. I've filled new issue #168807 since 
I'm not sure this fix has caused the problem. Issue #168807 is reproducible in trunk and 6.7.1 not in 6.7 fcs.

Would be good to fix issue #168807 in 6.7.1 before publishing it to avoid the regression.
Comment 22 Jindrich Sedek 2009-07-21 07:50:18 UTC
verified.
NetBeans IDE 6.7.1 (Build 200907202301)


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo