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

Bug 124313

Summary: Allow running JUnit test on a arbitrary selected group of folders and files
Product: java Reporter: gennady <gennady>
Component: JUnitAssignee: Theofanis Oikonomou <theofanis>
Status: RESOLVED FIXED QA Contact: junit-issues <junit-issues.netbeans.org>
Priority: P3 CC: apireviews, dkonecny, ecastro, geertjan, markiewb, matsa, mjr_1974, mkleint, obrejla, pribyl, tzezula
Version: 6.xKeywords: API, API_REVIEW_FAST, PLAN
Target Milestone: 8.0   
Hardware: All   
OS: All   
Whiteboard:
Issue Type: ENHANCEMENT Exception Report:
Attachments: proposed fix
proposed fix
proposed fix
proposed fix

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.
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