That sounds bad. reuseForks=false and forkCount=2 should spawn up to two JVMs in parallel (a new one for each test class), and the foobar parameter should be populated with a value of 1 or 2 and be distinct between concurrently running JVMs. If that doesn't work, you found a bug. :)
What happens when you use reuseForks=true? Does it work for you in that case? 2013/9/25 Laird Nelson <[email protected]> > Having trouble believing what I'm seeing, especially given the excellent > documentation at > > http://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html > , > but it seems to me that specifying <forkCount>2</forkCount> and > <reuseForks>false</reuseForks> using SureFire 2.16 simply doesn't do > anything (it seems to behave as though I had specified nothing). > > The debug output shows that the default value for forkMode (which I haven't > specified, per the documentation) is (as you would expect) 1, and the > behavior from my tests seems to indicate that this is trumping (i.e. > there's only one VM forked). > > Furthermore, including something like this: > > <systemPropertyVariables> > <foobar>${surefire.forkNumber}</foobar> > </systemPropertyVariables> > > ...yields null in my tests for: > > System.getProperty("foobar"); > > ...but if I change it to > > <systemPropertyVariables> > <foobar>bizbaw</foobar> > </systemPropertyVariables> > > ...then System.getProperty("foobar") yields "bizbaw" as I'd expect. > > The net behavior makes me think that I'm missing something fundamental, or > that the documentation has instructed me to do something that doesn't work. > > My JUnit dependency is 4.11 if it matters. > > Best, > Laird > > -- > http://about.me/lairdnelson >
