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 160777

Summary: [67cat] Debug test file generates xml output in project root for maven project
Product: java Reporter: neilg <neilg>
Component: ProjectAssignee: Jesse Glick <jglick>
Status: VERIFIED FIXED    
Severity: blocker CC: blaha, jglick, massimo, mkleint, sustaining
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 171050, 174173    
Attachments: right-click contextual menu on junit test class

Description neilg 2009-03-20 23:08:32 UTC
When I execute "debug test file" in a Maven project an xml report from the test run is output in the project root
directory rather than the target/surefire-reports directory.
Comment 1 Milos Kleint 2009-03-23 08:15:00 UTC
it seems to be generated by the JavaRunner's (compile on save) internal scripts. reassigning to java for evaluation
Comment 2 Jan Jancura 2009-03-23 09:29:32 UTC
we will look at it.
Comment 3 Milos Kleint 2009-03-25 07:53:53 UTC
*** Issue 161088 has been marked as a duplicate of this issue. ***
Comment 4 Jan Jancura 2009-05-07 13:57:28 UTC
*** Issue 162755 has been marked as a duplicate of this issue. ***
Comment 5 massimo 2009-06-17 00:59:41 UTC
Was going to submit a bug, but then saw this issue open in 6.7. I am assuming you have temporarily disabled the Debug
File action, as it no longer is enabled when right-clicking on a JUnit test class within a Maven project. Please confirm
or else i will open another issue.
Comment 6 Jesse Glick 2009-06-17 16:44:11 UTC
Dumping stray files into a versioned project directory is very bad and must be fixed. I think P2 is well justified.
Reproducible in 090615 (only in debugging mode). Anyway there is no reason that I can see to generate an XML report at
all for running a single test in debug mode.

Ought to be trivial to fix. (Why has this been sitting untouched for months?) Would even recommend 6.7 fix candidate
status. Try something like:

diff --git a/java.source.ant/src/org/netbeans/modules/java/source/ant/resources/junit-debug-snippet.xml
b/java.source.ant/src/org/netbeans/modules/java/source/ant/resources/junit-debug-snippet.xml
--- a/java.source.ant/src/org/netbeans/modules/java/source/ant/resources/junit-debug-snippet.xml
+++ b/java.source.ant/src/org/netbeans/modules/java/source/ant/resources/junit-debug-snippet.xml
@@ -91,7 +91,6 @@
                     <arg value="${classname}"/>
                     <arg value="showoutput=true"/>
                     <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
-                    <arg
value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-${classname}.xml"/>
                     <extra-args/>
                     <syspropertyset>
                         <propertyref prefix="test-sys-prop."/>
diff --git a/java.source.ant/src/org/netbeans/modules/java/source/ant/resources/junit-snippet.xml
b/java.source.ant/src/org/netbeans/modules/java/source/ant/resources/junit-snippet.xml
--- a/java.source.ant/src/org/netbeans/modules/java/source/ant/resources/junit-snippet.xml
+++ b/java.source.ant/src/org/netbeans/modules/java/source/ant/resources/junit-snippet.xml
@@ -59,7 +59,6 @@
                     <jvmarg value="-ea"/>
                     <jvmarg line="${run.jvmargs}"/>
                     <formatter type="brief" usefile="false"/>
-                    <formatter type="xml"/>
                     <syspropertyset>
                         <propertyref prefix="test-sys-prop."/>
                         <mapper from="test-sys-prop.*" to="*" type="glob"/>


massimo - Run/Debug File are now only for running main() methods. Use Test File & Debug Test File to invoke JUnit.
Comment 7 massimo 2009-06-17 20:21:29 UTC
Jesse, thanks, but i see no 'Debug Test File' action in the contextual menu (see attached image). Using junit 3.x,
standard J2SE installation of NetBeans 6.7 RC3. The only debug action available is 'Debug File', which is grayed out.
Comment 8 massimo 2009-06-17 20:22:42 UTC
Created attachment 83723 [details]
right-click contextual menu on junit test class
Comment 9 Jesse Glick 2009-06-17 20:48:05 UTC
massimo - it's not in the context menu (don't ask me why; filed separately IIRC) but it is in the main Debug menu and
available via C-S-F6.
Comment 10 massimo 2009-06-17 20:53:23 UTC
Beautiful, thanks (should of thought of that). Going to add an issue for it (and maybe provide a patch, should be
trivial to add in the contextual menu), it should probably go there as well.
Comment 11 Milos Kleint 2009-07-07 09:24:25 UTC
*** Issue 168182 has been marked as a duplicate of this issue. ***
Comment 12 Jesse Glick 2009-07-07 15:20:24 UTC
If not me, who? If not now, when? - רש"י‎
Comment 13 Jesse Glick 2009-07-07 15:42:52 UTC
core-main #918b569e5a3d
Comment 14 Quality Engineering 2009-07-08 05:36:12 UTC
Integrated into 'main-golden', will be available in build *200907080200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/918b569e5a3d
User: Jesse Glick <jglick@netbeans.org>
Log: #160777: do not pollute project dir (or $userdir/var/cache/executor-snippets) with TEST-*.xml.
Comment 15 Petr Blaha 2009-07-08 08:18:08 UTC
Reporter, would you verify the fix in the latest build *200907080200* on http://bits.netbeans.org/dev/nightly/? Thanks, Petr
Comment 16 Petr Blaha 2009-07-09 07:06:31 UTC
I was not able to reproduce (based on the provided steps) the bug in the latest build.
Comment 17 pgebauer 2009-07-09 09:54:42 UTC
The fix has been ported into the release67_fixes repository.
http://hg.netbeans.org/release67_fixes/rev/7aaee27c53b1
Comment 18 Jiri Prox 2009-07-16 14:54:54 UTC
v. in 6.7.1