Using jUnit 4, fork == always, TestSet triggers static initiailization for all
test classes in each forked process.
-------------------------------------------------------------------------------------------------------------------
Key: SUREFIRE-571
URL: http://jira.codehaus.org/browse/SUREFIRE-571
Project: Maven Surefire
Issue Type: Bug
Components: Junit 4.x support
Affects Versions: 2.4.3
Reporter: John Casey
It seems that initializing the Runner instance during construction of the
JUnitTestSet class causes surefire to trigger static initialization for each
test class, in each forked process. If you setup forkMode == always, this means
that every test class will have its static initialization triggered N times,
once for each class that is executed.
In cases where tests rely on static initialization to set system properties, or
something else that's a part of the static environment, forkMode == always
should isolate each test class from the others, providing a safe environment in
which each test can execute. Since the initialization of these TestSets is
eager (rather than lazy), it doesn't matter that only one of the TestSet
instances will actually be run; they all execute any static blocks they contain.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira