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 70850

Summary: Run all tests in a suite
Product: apisupport Reporter: Jaroslav Tulach <jtulach>
Component: HarnessAssignee: Jesse Glick <jglick>
Status: RESOLVED FIXED    
Severity: blocker CC: jskrivanek, junit-issues, tboudreau, tomwheeler
Priority: P2 Keywords: PLAN
Version: 5.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: based on 200709060000 daily build harness
based on 200709060000 daily build harness
Recast as a source patch
First stab at adding item to context menu (not yet tested)

Description Jaroslav Tulach 2005-12-29 16:31:08 UTC
In a project I have I need an easy way to run all my tests. E.g. to run tests 
for all modules in suite. I am not sure if there is an easy way to do it 
(except writing the target myself), but I know many people would welcome "Run 
All Unit Tests" item in suite's popup menu.
Comment 1 Jan Lahoda 2005-12-29 20:17:37 UTC
I would like to have this too. I have an experimental version of this done, will
try finalize it and attach a patch.
Comment 2 Jesse Glick 2005-12-29 20:44:32 UTC
Should be pretty easy, I guess.
Comment 3 tomwheeler 2007-09-06 23:49:17 UTC
Created attachment 48342 [details]
based on 200709060000 daily build harness
Comment 4 tomwheeler 2007-09-06 23:49:33 UTC
Created attachment 48343 [details]
based on 200709060000 daily build harness
Comment 5 tomwheeler 2007-09-06 23:52:19 UTC
The attached files make it possible to run tests on modules within a suite, taking care not to run tests where none
would be defined (i.e. any module which does not have a unit test directory).  Sorry that I didn't include diffs; I did
not see where common.xml comes from in CVS, but these are very small changes based on the build harness distributed with
today's daily build.
Comment 6 Jesse Glick 2007-09-06 23:59:22 UTC
Created attachment 48347 [details]
Recast as a source patch
Comment 7 Jesse Glick 2007-09-07 00:00:25 UTC
Would also need apisupport/project changes to expose the Test action on the suite.

Well past feature freeze for 6.0, unfortunately.
Comment 8 tomwheeler 2007-09-07 16:14:38 UTC
Thanks for turning it into a patch.  Maybe it can go into some post 6.0 release. Even though there is no UI support in
the IDE, you can still run it from Ant.  The "JUnit Test Results" window will show the status of all tests from all
modules in the suite.

If you can give me a hint as to where UI support for running the tests from the suite should go, I might be able to do
that too.
Comment 9 Jesse Glick 2007-09-07 17:38:32 UTC
apisupport/project/src/org/netbeans/modules/apisupport/project/ui/SuiteActions.java

(compare to ModuleActions)
Comment 10 tomwheeler 2007-09-11 00:11:50 UTC
Created attachment 48528 [details]
First stab at adding item to context menu (not yet tested)
Comment 11 tomwheeler 2007-09-13 05:18:45 UTC
I tested the patches tonight and they're working fine for me.  The "test" menu item on the context menu for the suite is
bound to the shortcut Alt+F6 (on amd64 Linux anyway). I didn't intentionally set that, but maybe that's how it's
supposed to be.  Otherwise, it worked perfectly, as described below.

I applied both patches to a local copy of the trunk and built the IDE.  I created a new suite, then added a source
module  to that suite.  I added a simple class and corresponding unit test to the module, ran the new suite-level test
target and it ran the expected tests.  I added a library module to the suite, ran the test target again and it worked
fine (i.e. it did not try to run non-existent tests in the library module).  Finally, I added another source module to
the suite, again with a simple class and corresponding unit test.  The suite-level test menu item executed unit tests in
both modules.
Comment 12 Jesse Glick 2007-09-13 22:54:07 UTC
Well remind me after 6.0 has been branched. I cannot commit anything at the moment, unfortunately - trunk is for 6.0 yet
only bug fixes are accepted; there is no place to commit post-6.0 enhancements.
Comment 13 tomwheeler 2007-09-13 23:13:33 UTC
Will do
Comment 14 pzajac 2007-09-14 09:47:26 UTC
IMHO it's no enhancement but defect. Everyone, who writes tests, wants to run tests for all modules in suite.  I'm for
to create from this enhancement defect.   
Comment 15 Jesse Glick 2007-09-14 17:19:49 UTC
Sorry, no. It may be a very desirable and natural feature to add, but the current design of suite projects intentionally
does not include it, nor does the UI spec request it.
Comment 16 tomwheeler 2007-10-22 19:08:14 UTC
Adding Tim to cc list and adding status whiteboard string to group issues we discussed/worked on last week.
Comment 17 tomwheeler 2007-12-21 18:02:29 UTC
You asked for a reminder about this after 6.0 had been branched.
Comment 18 Jesse Glick 2008-02-20 21:18:22 UTC
Applied (#9fb9f1dd4a3d) with changes:

1. Need to sort by test dependencies, not just regular module dependencies.

2. Context menu item name changed to "Test All" for consistency with "Build All" etc.

3. Using ActionProvider.TEST constant.

4. Enabling action only for suites using 6.1+ harness.