Issue Details (XML | Word | Printable)

Key: SUREFIRE-555
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Stephen Connolly
Reporter: Kristian Rosenvold
Votes: 12
Watchers: 10
Operations

If you were logged in you would be able to see more operations.
Maven Surefire

Support junit core for parallel running of tests

Created: 02/Jul/09 07:36 AM   Updated: 07/Jan/10 03:25 AM   Resolved: 04/Jan/10 09:42 AM
Return to search
Component/s: Junit 4.x support
Affects Version/s: None
Fix Version/s: 2.5

Time Tracking:
Not Specified

File Attachments: 1. Text File surefire.patch (49 kB)
2. Text File surefirev2.patch (112 kB)
3. Text File surefirev3.patch (69 kB)
4. Text File surefirev4.patch (72 kB)

Environment: All
Issue Links:
Duplicate
 

Complexity: Intermediate
Testcase included: yes
Patch Submitted: Yes


 Description  « Hide

The enclosed patch adds junitcore support to surefire. The patch requires junit 4.6 (the latest released version) to compile, but is only activated when running with the 4.7 snapshot or higher (due to some bugs in 4.6). The patch adds one extra setting to the surefire plugin. More details at http://incodewetrustinc.blogspot.com/

The new plugin also requires an external library which can be found at http://github.com/krosenvold/configurable-parallel-computer/tree/master, which will be bumped to 1.0 when/if you decide to accept the patch. I am requesting that the junit project actually accept the features of the configurable-parallel-computer as a standard feature in junit 4.7, but that's not decided yet. I do not have a public maven repo that is hosting configurable-parallel-computer, but was hoping maybe you could publish it ?



Kristian Rosenvold added a comment - 07/Oct/09 03:25 PM

Attached is an updated patch for junit 4.7. The revised patch also has no dependencies to any external libraries.


Brett Porter added a comment - 03/Nov/09 02:33 PM

Who are the original authors in the dual licensed pieces of code and where did it come from?


Kristian Rosenvold added a comment - 03/Nov/09 03:48 PM - edited

I am. I made it dual licensed to be compatible with the junit license. If this is a problem I can change it - I hope The project is located at http://github.com/krosenvold/configurable-parallel-computer


Brett Porter added a comment - 03/Nov/09 06:19 PM

It doesn't have to be, but ideally it would all have the "licensed to Apache..." header they all share. Since it is your own work you can certainly do that. Would you mind resubmitting?

I would like some other changes and clarification:

  • instead of "junitcore" is this basically a "junit 4.7+" feature? I got a bit confused by the terminology
  • the version parsing seems unusual - can we use a range instead ("[4.7,)")
  • can you remove the .orig files from the patch?
  • what is the purpose of the separated directory scanner?

Let me know if you need any more info on these.


Kristian Rosenvold added a comment - 03/Nov/09 07:25 PM

Yes to all. Will resubmit tomorrow.

The purpose of the separated directory scanner was really just to get it unit-testable as an individual piece. I suppose I couldn't resist the urge to make things more unit-testable, since they're both faster and easier to write. There is also a unit-test for that separate piece of code. At that point I guess It was a bit irresponsible of me not to replace usage in the other plugins too, but I suppose I realized I was getting a bit carried away. The api-contract of the separated scanner is also slightly cleaner than the original.

I can take this both ways (revert to old-style or change the other plugins), what do you think ?


Brett Porter added a comment - 03/Nov/09 10:40 PM

that's fine, I couldn't see a big change so just checking whether it was meant to do something I couldn't see


Kristian Rosenvold added a comment - 04/Nov/09 04:42 AM

This is version 3 of the patch (surefirev3.patch). Includes all requested changes.

I will try to submit a subsequent patch to change the other providers to use the external scanner, but this patch is totally self-contained.


Kristian Rosenvold added a comment - 04/Nov/09 05:29 AM

It turns out I had done "the right" thing and extracted all the directory scanning to the separate class, so this is effectively in use by all the providers (it was done in the base class for the providers and I extracted it to get more precise test coverage and re-use for the junit 4.7 provider)

Since I'm not totally fluent in the maven internals, you may also want to just check the methods isJunit40to46 and isJunit47Compatible in the revised patch, just in case there's a better way to do it.


Kristian Rosenvold added a comment - 04/Nov/09 10:10 AM - edited

v4 also includes what I hope is the appropriate license headers in all files.

Also note that after I artifactid & name of the provider to surefire-junit47 I had to run mvn -N install within the surefire-providers folder and the root folder to get things to compile (assuming you have compiled the previous version within the same checkout)


Igor Minar added a comment - 05/Dec/09 09:51 PM

hi there,

Will the patch be accepted? This new feature looks very interesting.

thanks,
Igor


Daniel Gredler added a comment - 01/Jan/10 01:35 PM

Please apply this patch (or similar) and let me run my unit tests in half the time


Stephen Connolly added a comment - 04/Jan/10 02:08 AM

targetting for 2.5


Stephen Connolly added a comment - 04/Jan/10 09:42 AM

r895651.


Paul Benedict added a comment - 07/Jan/10 02:22 AM

This issue was created when JUnit 4.7 was current. The latest version is now 4.8.1.


Kristian Rosenvold added a comment - 07/Jan/10 03:25 AM

The patch I supplied uses "any" version of surefire >= 4.7. 4.8 is also recommended, since it contains 2 concurrency patches I submitted to junit. Hopefully, 4.8.1 will find its way to a maven repo soon.