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 124313 - Allow running JUnit test on a arbitrary selected group of folders and files
Summary: Allow running JUnit test on a arbitrary selected group of folders and files
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: JUnit (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 3 votes (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords: API, API_REVIEW_FAST, PLAN
: 143763 185379 203078 229778 234031 234255 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-12-20 09:43 UTC by gennady
Modified: 2013-11-15 10:10 UTC (History)
11 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
proposed fix (36.64 KB, patch)
2013-11-08 23:08 UTC, Theofanis Oikonomou
Details | Diff
proposed fix (40.40 KB, patch)
2013-11-09 13:04 UTC, Theofanis Oikonomou
Details | Diff
proposed fix (42.51 KB, patch)
2013-11-12 16:34 UTC, Theofanis Oikonomou
Details | Diff
proposed fix (42.41 KB, patch)
2013-11-14 14:45 UTC, Theofanis Oikonomou
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description gennady 2007-12-20 09:43:26 UTC
Currently, through NetBeans 6.0 UI it is possible to run JUnit tests on a whole project or on a selected file. It would 
be nice to select folders/files (or in sources either tests folders) and then be able to run tests for them, especially 
this is supported by build-iml.xml. It is possible to do this using Run Target->Advanced on the xml file and then 
setting javac.included and test.included, but this is inconvenient.
Comment 1 Alexei Mokeev 2009-03-27 07:42:30 UTC
It's still the case for NB 6.5. As a side-effect you could multiple selection in project tree, invoke Test File by
Ctrl+F6, but only tests for one selected file are executed.
Comment 2 Alexei Mokeev 2009-03-27 08:22:56 UTC
See also issue 143763
Comment 3 Alexei Mokeev 2010-05-05 10:31:03 UTC
*** Bug 185379 has been marked as a duplicate of this bug. ***
Comment 4 ecastro 2010-05-05 12:05:18 UTC
When the "Test File" menu item in the Project window does not support multiple
selection.
It should either:
- be disabled when more than one file is selected.
- launch the test for all the selected classes (at least those with are JUnit
or TestNG compatible).

Tested on 6.9 Beta
Comment 5 Theofanis Oikonomou 2013-05-16 12:26:07 UTC
*** Bug 229778 has been marked as a duplicate of this bug. ***
Comment 6 markiewb 2013-08-06 21:10:41 UTC
*** Bug 234031 has been marked as a duplicate of this bug. ***
Comment 7 Theofanis Oikonomou 2013-09-04 14:55:56 UTC
*** Bug 234255 has been marked as a duplicate of this bug. ***
Comment 8 Theofanis Oikonomou 2013-09-04 14:56:05 UTC
*** Bug 143763 has been marked as a duplicate of this bug. ***
Comment 9 Theofanis Oikonomou 2013-09-04 14:56:12 UTC
*** Bug 203078 has been marked as a duplicate of this bug. ***
Comment 10 Theofanis Oikonomou 2013-09-04 14:57:17 UTC
Planning for next release. Thank you for reporting
Comment 11 ArchieBeans 2013-09-20 11:39:44 UTC
When right-clicking on a package selection, it would be useful if all the following options were available:

   * Run all tests in this package (excluding sub-packages)
   * Run all tests in this package (including sub-packages)
   * Run all tests in sub-packages (excludes current package)
Comment 12 Theofanis Oikonomou 2013-11-08 23:08:16 UTC
Created attachment 142018 [details]
proposed fix

I am attaching the changes needed in order for this feature to work.

The user can invoke "Test Package(s)" action to test all the files under the selected package(s).
The selected package(s) must all be under source or test roots and cannot intermix.

Additionally, the user can invoke "Test File(s)" action to test all the selected file(s).
The selected file(s) can be under source or test roots and can intermix.
Comment 13 Theofanis Oikonomou 2013-11-08 23:11:00 UTC
I am starting a review for two changes:

Added new method in o.apache.tools.ant.module.api.support.ActionUtils class 
in order to also search for files under a selected package.

Modified the build-impl.xsl files for java.j2seproject, j2ee.clientproject, j2ee.ejbjarproject and web.project types.
I think this is a compatible change but I would appreciate any comments on this to avoid braking the scripts.

Please review these two changes. Any comments on the other parts are also welcomed. Thank you
Comment 14 Theofanis Oikonomou 2013-11-09 13:04:04 UTC
Created attachment 142022 [details]
proposed fix

updated the patch to handle the case were in a maven project multiple files are selected from both source and test packages and "Test Files" action is invoked on them
Comment 15 Theofanis Oikonomou 2013-11-12 16:34:53 UTC
Created attachment 142104 [details]
proposed fix

While trying to sync the j2se behavior to the api.support one I realised that there is no need for new method in o.apache.tools.ant.module, so I am updating the patch. Please, comment on the changes in build scripts. Thank you
Comment 16 Tomas Zezula 2013-11-14 14:08:26 UTC
Seems good to me.
Comment 17 Theofanis Oikonomou 2013-11-14 14:45:51 UTC
Created attachment 142185 [details]
proposed fix

minor change in maven project case so that when "Test package" is invoked all tests under that package are run recusively. If there are no objections I will integrate tomorrow. Thank you
Comment 18 Theofanis Oikonomou 2013-11-15 10:10:04 UTC
Fixed: http://hg.netbeans.org/core-main/rev/c03915e9d1b0. Thank you for the comments.