I dimly remember that once upon a time many years ago you had to explicitly
specify the system properties to be made available to your JUnit tests
running under Surefire:
<systemPropertyVariables>
<x>y</x>
</systemPropertyVariables>
(The documentation for this element reads in total: "List of System
properties to pass to a provider.")
That is, without this XML, running mvn test -Dx=y would not propagate a
System property named "x" into the Surefire process as a system property.
I adopted the habit of doing something like this in my pom.xmls:
<systemPropertyVariables>
<x>${x}</x>
</systemPropertyVariables>
...so that Maven properties would be "tunneled through" into System
properties visible in a JUnit test.
Now I'm running Surefire 3.1.2 and noting that this all no longer seems
necessary: running mvn test -Dx=y without any special XML to "turn it into"
a System property works fine (my test can assert
System.getProperty("x").equals("y")).
Is that in fact true, or is Surefire somehow running in process with Maven,
or is this a property of the JUnit engine/provider, or...?
Thanks,
Best,
Laird