Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!

Bug 214334

Summary: [72cat] Rerun failed button does not work for Maven projects
Product: projects Reporter: crazyjavahacking
Component: MavenAssignee: Milos Kleint <mkleint>
Status: RESOLVED FIXED QA Contact: issues <issues.netbeans.org>
Priority: P2 CC: everflux, mmirilovic, musilt2
Version: 7.2   
Target Milestone: 7.3   
Hardware: PC   
OS: Windows 7 x64   
Whiteboard: 72patch1-verified
Issue Type: DEFECT Exception Report:
Attachments: Maven project to test

Description crazyjavahacking 2012-06-17 10:53:23 UTC
I just discovered, that 'Rerun failed' button part of Test Results window does not work correctly for Maven projecs.

To reproduce:
1.) Download the Java SE project from http://wiki.netbeans.org/wiki/images/c/c0/JUnitSampleProject_TS_68_JUnit.zip
2.) Create empty Maven Java SE project
3.) Copy the 'teststorun' package from 1.) to Maven project
4.) Generate tests for JUnit4 and run them
5.) Click on 'Rerun failed' button from Test Results window

=> nothing will be executed, the content of Test Results window will contain 'No tests executed'.

I think this is really serious bug and probably a showstopper for NetBeans 7.2.


NetBeans 7.2 RC1, Java 7u5 32bit
Comment 1 everflux 2012-06-17 13:05:09 UTC
I just tested that with an existing maven based project in NB 7.2rc1
It works as expected for me.
Have you turned compile on save on or off?
How did you initially run the test?
Comment 2 crazyjavahacking 2012-06-17 15:32:20 UTC
Created attachment 120957 [details]
Maven project to test

Ataching Maven project to test...
Comment 3 crazyjavahacking 2012-06-17 15:33:06 UTC
It does not work for both Compile on Save for tests on and off.
Comment 4 Tomas Danek 2012-06-18 08:54:22 UTC
I am able to reproduce with attached project in 
 Product Version: NetBeans IDE 7.2 RC1 (Build 201206141830)
Java: 1.7.0_04; Java HotSpot(TM) 64-Bit Server VM 23.0-b21
System: Mac OS X version 10.7.4 running on x86_64; US-ASCII; en_US (nb)
User directory: /Users/tomas/Library/Application Support/NetBeans/7.2rc1
Cache directory: /Users/tomas/Library/Caches/NetBeans/7.2rc1
Comment 5 Theofanis Oikonomou 2012-06-18 08:57:39 UTC
I can only reproduce if I invoke Alt+F6 on the project (2 passed, 8 failed, 1 error). If I then invoke run failed I get the reported status. If I invoke Ctrl+F6 on the test suite I get again (2 passed, 8 failed, 1 error) but now if I invoke run failed I get (0 passed, 8 failed, 1 error). Similar behavior if I test only one file and then rerun failed on the results. I think the problem is somewhere in the implementation of RerunHandler's rerun(Set<Testcase> tests) method in JUnitOutputListenerProvider. Milosi could you evaluate please. Thank you
Comment 6 Milos Kleint 2012-06-18 11:45:54 UTC
most likely caused upstream by http://jira.codehaus.org/browse/SUREFIRE-844


when I try on cmd line: 
mvn -Dtest=teststorun.StatementsTest#testMyOwn test
(works!)

mvn -Dtest=teststorun.StatementsTest#testMyOwn,teststorun.IfaceTest#testMethodUsingString test
(FAILS!)

mvn -Dtest=teststorun.StatementsTest,teststorun.IfaceTest test
(works!)

which sort of aligns with the sample usage in http://maven.apache.org/plugins/maven-surefire-plugin/examples/single-test.html. That page never mentions that running multiple methods from different classes works.

I'll file an issue with surefire, hopefully with a patch. However no the netbeans side there's not much we can do here apart from disabling the rerun in this case. I haven't tested with testng.
Comment 7 Milos Kleint 2012-06-18 12:35:31 UTC
it seems to be filed under http://jira.codehaus.org/browse/SUREFIRE-745 and fixed in upcoming 2.13 of maven surefire plugin
Comment 8 Milos Kleint 2012-06-18 12:36:12 UTC
not sure what can be done in netbeans apart from disabling the failing case and not allow rerunning in this case..
Comment 9 crazyjavahacking 2012-06-18 15:45:53 UTC
In such case, I will vote for Go for NetBeans 7.2 RC1.

Thanks for fast investigation.(In reply to comment #8)
> not sure what can be done in netbeans apart from disabling the failing case and
> not allow rerunning in this case..

In such case, I will vote for Go for NetBeans 7.2 RC1.

Thanks for fast investigation.
Comment 10 crazyjavahacking 2012-06-18 15:51:13 UTC
Sorry for changing bug details...
Comment 11 Quality Engineering 2012-06-20 04:36:50 UTC
Integrated into 'main-golden', will be available in build *201206200001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/b2109cc6d6d0
User: Milos Kleint <mkleint@netbeans.org>
Log: #214334 for rerun failed, check if given combination of surefire and test framework support running single methods
Comment 12 Milos Kleint 2012-06-20 05:55:18 UTC
I believe the issue is fixed.

What needs t be tested -
It's a matrix of these variables:
1. maven surefire plugin version    
   1a. often surefire version is not defined in pom, then what maven version is used counts..
2. junit version / testng version
3. one or multiple tests failing (please note that with junit4, only the future 2.13 surefire plugin will work with multiple failing tests, there's no way tell if one or multiple are failing when enabling so it's disabled)
Comment 13 Milos Kleint 2012-06-20 07:06:45 UTC
*** Bug 214240 has been marked as a duplicate of this bug. ***
Comment 14 Milos Kleint 2012-08-03 07:24:57 UTC
one more patch: http://hg.netbeans.org/core-main/rev/53c2709e6239
surefire plugin 1.12.1 was released and apparently either the syntax for multiple test methods per test file has changed or it never worked or worked by coincidence.
Now multiple methods per file work for junit 4 but don't for testng (not implemented). There's no way to distinguish that in our enablement logic for the button though.
Comment 15 Milos Kleint 2012-08-03 14:41:54 UTC
http://hg.netbeans.org/releases/rev/0f292d5096b7
Comment 16 Quality Engineering 2012-09-01 11:09:07 UTC
Integrated into 'releases', will be available in build *201209010822* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/0f292d5096b7
User: Milos Kleint <mkleint@netbeans.org>
Log: #214334 transplant to release72 branch
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo