[
https://jira.codehaus.org/browse/SUREFIRE-974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=322096#comment-322096
]
Andreas Gudian commented on SUREFIRE-974:
-----------------------------------------
For a test execution in one module, Surefire auto-selects exactly one of its
test-provider implementations (that's the internal name of the components that
bridge from Surefire to an arbitrary test framework, such das TestNG, JUnit3,
JUnit 4 and JUnit 4.7).
As soon as grouping or the parallel option is set to something else then the
default and Junit >= 4.7 is on the classpath, Surefire will select the test
provider "surefire-junit47". If neither grouping nor parallel is specified,
"surefire-junit4" is selected (if JUnit >= 4 is on the classpath). The
difference between both of them is the way they hand over the class to JUnit.
surefire-junit4 does {{Request.aClass( testClass ).getRunner().run(...)}},
whereas junit47 does something like the following (without threading / parallel
forking):
{code}
JUnitCore junitCore = new JUnitCore();
Request req = Request.classes( new Computer(), classesToRun );
junitCore.run( req );
{code}
If that doesn't help you and you're still sure to some extent that this is not
a bug in JUnit itself, but in Surefire, then perhaps provide us a small and
condensed example project.
> Custom junit.framework.TestSuite subtypes ignored when excludedGroups defined
> -----------------------------------------------------------------------------
>
> Key: SUREFIRE-974
> URL: https://jira.codehaus.org/browse/SUREFIRE-974
> Project: Maven Surefire
> Issue Type: Bug
> Affects Versions: 2.14
> Reporter: Jesse Glick
>
> In Jenkins sources @ 919bab8, run:
> {{mvn -f test/pom.xml -Dtest=CoreJellyTest
> -Dtest.excluded.groups=org.jvnet.hudson.test.FailsOnCloud test}}
> You will get errors from every test case in this suite. When
> {{test.excluded.groups}} is not defined, it passes.
> This property just sets {{excludedGroups}} for the benefit of some unrelated
> JUnit 4 tests in the same module which use {{@Category}}. But turning it on
> apparently changes how JUnit 3 tests are run, too. The named suite has a
> {{public static Test suite()}} method which creates a subclass of
> {{TestSuite}} that overrides {{void run(TestResult)}}; when
> {{excludedGroups}} is defined, a plain {{TestSuite}} is created which fails
> to set the proper context for test cases and fails utterly.
> Refactoring this test suite to use JUnit 4 idioms is probably not an option
> at the moment for compatibility reasons. Why is Surefire failing to correctly
> run JUnit 3 tests just because groups are defined?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira