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 214225 - Right-click Test File doesn't run the tests that were generated by NetBeans for that File with JUnit 4 and Maven project
Summary: Right-click Test File doesn't run the tests that were generated by NetBeans f...
Status: RESOLVED WORKSFORME
Alias: None
Product: java
Classification: Unclassified
Component: JUnit (show other bugs)
Version: 7.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-14 15:52 UTC by swpalmer
Modified: 2017-01-07 11:48 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
better example (14.09 KB, application/zip)
2012-06-22 20:23 UTC, swpalmer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description swpalmer 2012-06-14 15:52:56 UTC
Product Version = NetBeans IDE Dev (Build 201206110001)
Operating System = Windows 7 version 6.1 running on x86
Java; VM; Vendor = 1.7.0_04
Runtime = Java HotSpot(TM) Client VM 23.0-b21

When I right click on my class file and select "Test File" no tests run:

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 0.888s
Finished at: Thu Jun 14 11:50:38 EDT 2012
Final Memory: 5M/15M
------------------------------------------------------------------------
Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-cli) on project test: No tests were executed!  (Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]

However, if I just select to run all the tests by right-clicking on theproject and selecting "Test", it works:

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 1.119s
Finished at: Thu Jun 14 11:51:55 EDT 2012
Final Memory: 6M/15M
------------------------------------------------------------------------


The test file was generated by NetBeans using Tools->Create Tests
Comment 1 rptmaestro 2012-06-20 22:32:55 UTC
The maven-surefire-plugin 2.12 has broken the ability to run single tests. You may need to change the surefire plugin version to 2.11.
Comment 2 swpalmer 2012-06-22 20:23:42 UTC
Created attachment 121235 [details]
better example
Comment 3 swpalmer 2012-06-22 20:25:00 UTC
I replaced the example with one that is more runnable

You can set a breakpoint on line 46, but not on line 22.

At runtime I get:

Listening on javadebug
User program running
LineBreakpoint BreakPointBug.java : 46 successfully submitted.
Not able to submit breakpoint FieldBreakpoint bug.report.BreakPointBug$1.computeReadyListener, reason: Field 'computeReadyListener' does not exist in class bug.report.BreakPointBug$1.
Breakpoint hit at line 46 in class bug.report.BreakPointBug by thread AWT-EventQueue-0.
Thread AWT-EventQueue-0 stopped at BreakPointBug.java:46.
Comment 4 swpalmer 2012-06-22 20:29:07 UTC
Sorry due to idiotic Bugzilla moving to unrelated bugs after submitting, this ended up in the wrong issue.
Comment 5 Theofanis Oikonomou 2012-10-29 13:10:07 UTC
I cannot reproduce in NetBeans IDE Dev (Build 20121024-d3ca6f6fc27b). Tried with junit3 and junit4 test classes. They were run as expected. Please reopen if it still happens for you in latest build. Thank you
Comment 6 mkrivan 2017-01-07 11:48:03 UTC
The surefire plugin 2.19 has the same issue but in 2.19.1 it is working again. The So the single test on file in maven project works from IDE.