[ 
https://jira.codehaus.org/browse/SUREFIRE-974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=322817#comment-322817
 ] 

Jesse Glick commented on SUREFIRE-974:
--------------------------------------

The {{JUnit4TestAdapter}} workaround does not work when using 
{{TestSuite.<init>()}} and {{.addTest(Test)}}, however. For that case 
implementing {{Filterable}} to do nothing is acceptable since typically the 
{{Test suite()}} computed a set of tests to add in a way that would not 
intrinsically support filtering to begin with; in my case the test cases do not 
correspond to methods.

I do notice some other differences in the result files between test runs using 
{{excludedGroups}} and those without. For example, normally {{TEST-*.xml}} is 
named according to the class defining the {{suite}} method, with {{classname}} 
specifying the class extending {{TestSuite}}. But with {{excludedGroups}} the 
result file is named according to the suite class ({{classname}} also 
specifying this), and there is no indication anywhere of the name of the class 
defining {{suite}}. Not sure if this is fixable on the Surefire side.
                
> 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
>            Assignee: Andreas Gudian
>             Fix For: 2.15
>
>         Attachments: SUREFIRE-974.zip
>
>
> 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

Reply via email to