Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

While SuiteClasses is annotated with @Inherited, IncludeCategories and ExcludeCategories are not #3

Closed
GoogleCodeExporter opened this issue Apr 27, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Abstract test suite in a shared project:
@RunWith(WildcardPatternSuite.class)
@SuiteClasses("**/*Test.class")
@ExcludeCategories({ SlowTests.class })
public abstract class AbstractAllNonSlowTestSuite {
}
2. Concrete test suite in each concrete project extending from the shared 
abstract one:
public class AllNonSlowTestSuite extends AbstractAllNonSlowTestSuite { }
3. Test class with 1 slow test:
public class With1SlowTest_Test {
    @Test
    public void a() {
                fail();
    }

    @Category(SlowTests.class)
    @Test
    public void testSlow() {
        fail();
    }
}

What is the expected output? What do you see instead?
I think because IncludeCategories annotation is not annotated with @Inherited, 
With1SlowTest_Test.testSlow() is not filtered/excluded when executing 
AllNonSlowTestSuite.

What version of the product are you using? On what operating system?
1.8

Please provide any additional information below.
I was trying this approach with abstract test suite with whole configuration to 
avoid a little bit of duplication in each project's test suite. I hope I have 
not missed anything.

Original issue reported on code.google.com by reinhold...@googlemail.com on 31 Mar 2014 at 1:34

@GoogleCodeExporter
Copy link
Author

Probably according to the principle of the least surprise, the annotations 
@ExcludeCategories and @IncludeCategories are configured like their JUnit 
companions @IncludeCategory, @ExcludeCategory.

Reinhold, I agree @Inherited is meaningful. Or is there a way to apply 
composition over inheritance?

By the way, I believe not earlier than in the newest SNAPSHOT version of JUnit 
11, @Category is annotated with @Inherited. I don't understand why this 
annotation wasn't added from the beginning. The JUnit guys do not seem to like 
@Inherited.

Original comment by rwoo@gmx.de on 2 May 2014 at 3:13

@GoogleCodeExporter
Copy link
Author

Thanks for your comments: I must admit that keeping consistency/similarity with 
JUnit sounds like a good argument too.

ad "composition over inheritance": Frankly I don't know of any applicable 
approach (that would be also nice or non-ugly).

=> Thus, I am okay with every/either decision you take (adding @Inheritance vs. 
resolving issue with won't fix)

Original comment by reinhold...@googlemail.com on 12 May 2014 at 11:47

@GoogleCodeExporter
Copy link
Author

As rwoo@gmx.de suggested I would rather not add @Inherited to IncludeCategories 
and ExcludeCategories as long as the original JUnit annotations 
Categories.IncludeCategory and Categories.ExcludeCategory do not have the 
@Inherited annotation.

Original comment by michael.tamm2 on 16 Jun 2014 at 8:01

  • Changed state: WontFix
  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

@GoogleCodeExporter
Copy link
Author

Original comment by michael.tamm2 on 16 Jun 2014 at 8:02

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant