Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 161416 - test file action doesn't work in maven project with junit4
test file action doesn't work in maven project with junit4
Product: java
Classification: Unclassified
Component: JUnit
All All
: P3 with 2 votes (vote)
: 6.x
Assigned To: Theofanis Oikonomou
Depends on:
  Show dependency treegraph
Reported: 2009-03-29 16:11 UTC by Jindrich Sedek
Modified: 2012-10-16 12:20 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT

sample project (5.05 KB, application/x-gzip)
2009-03-30 11:36 UTC, Jindrich Sedek
log directory (145.77 KB, application/octet-stream)
2012-06-22 21:29 UTC, massimo

Note You need to log in before you can comment on or make changes to this bug.
Description Jindrich Sedek 2009-03-29 16:11:12 UTC
Create new maven project
use project properties to switch source level to 1.5
in pom.xml switch junit version to 4.4
create new junit test -> created with junit 4 -> OK
invoke uncomment generated test , invoke Test action on project -> test is running -> OK
invoke Test File action on the junit 4 file -> test is not started (the same for BeforeClass, Before etc. annotated 
methods) it seems that junit3 is used to run simple file
Comment 1 Milos Kleint 2009-03-29 20:12:30 UTC
Sorry, I cannot reproduce. I was able to run the junit 4 test with or without compile on save on. Also I tried renaming
the test method to mainone() instead of the testMain() junit3 convention but it still got executed.

closing as worksforme, please state more details about your setup and how to reproduce. I'm using 20090326 (built from
main repo)

Comment 2 Jindrich Sedek 2009-03-30 11:35:16 UTC
I'm trying to reproduce using steps I've described yesterday, but it works for me as well :-( I'm not sure what was (is)

I'm now playing with it and I'm facing the same problem with bit more complicated project with junit4 - "Test" action
works well, but "Test File" does not. 

My test file extends org.junit.TestCase, but it's annotated with @RunWith(JUnit4ClassRunner.class) so it should be run
with junit 4 runner. I'll attach my project. 
Comment 3 Jindrich Sedek 2009-03-30 11:36:24 UTC
Created attachment 79047 [details]
sample project
Comment 4 Milos Kleint 2009-04-01 13:18:38 UTC
with you test project it seems to affect CoS driven Test File action only. If you disable CoS, the test runs correctly
through maven.
Reassigning to java for evaluation. That's where the JavaRunner is implemented AFAIK.
Comment 5 Max Sauer 2009-04-15 12:21:51 UTC
This issue has nothing to do with JavaRunner, in fact, it is an issue of JUnit support, since it uses JUnit 3.x for all classes extending junit.framework.TestCase. Reproducible also with j2seproject. 

Workarounds are:
- disable COS for maven -- fallback to maven works OK, since it does not use patched Ant.
- rename your methods to test* ;)
- do not extend TestCase

I think this can qualify as a P3.

netbeans_home/java2/ant/patches/72080.jar#Ant-1.7.1-source-code-patch-72080.diff, -357,43 +397,98 hunk.

Sorry Marian :(
Comment 6 ceefour 2009-07-14 20:54:30 UTC
Any progress on this issue? Thank you.
Comment 7 Alexei Mokeev 2009-07-29 09:04:03 UTC
Still valid.
Comment 8 Milos Kleint 2009-07-29 09:50:29 UTC
av: setting the target milestone shall be done by developers and means that it's not planned for 6.8, not sure if that's
what you wanted.
Comment 9 Alexei Mokeev 2009-07-29 10:14:54 UTC
Yes, that's exactly what I planned to say :) This bug is valid and serious, but so far we don't plan to fix this for 6.8
unless time/bug situation permits.
Comment 10 massimo 2012-06-22 21:29:18 UTC
Created attachment 121239 [details]
log directory
Comment 11 massimo 2012-06-22 21:30:50 UTC
sorry, please disregard the attachment i have just uploaded: i meant to upload it into a different bug.
Comment 12 Theofanis Oikonomou 2012-10-16 12:20:48 UTC
I am sorry but I cannot reproduce in NetBeans IDE 7.2 (Build 201207171143). I opened your project and invoked test and Test File actions. Both run as expected. Please reopen if it still happens for you. Thank you

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