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

Multiple categories for @IncludeCategory and @ExcludeCategory #146

Closed
merland opened this issue Oct 25, 2010 · 12 comments
Closed

Multiple categories for @IncludeCategory and @ExcludeCategory #146

merland opened this issue Oct 25, 2010 · 12 comments
Labels

Comments

@merland
Copy link

merland commented Oct 25, 2010

Hi list!

It would be great if @IncludeCategory and @ExcludeCategory would accept multiple categories
like the @category annotation does today.

There is a not-so-beatiful workaround. You can get multiple includes or excludes
if you create an inheritance hierarchy of suites and exclude one category on
each level.

@nemoo
Copy link

nemoo commented Jun 10, 2011

Yes, please!

@ajmath
Copy link

ajmath commented Oct 11, 2011

I couldn't get your suggested workaround to work. Could you provide more details?

@merland
Copy link
Author

merland commented Oct 11, 2011

Ok, lets see if I remember some of this... Been a while.
I'll just give you the code example I've got. Might be broken, haven't run it recently. Hope it helps.


Say I have a UnitTestSuite that should exclude the category "SlowTest" AND the category "IntegrationTest".

/**

  • By inheriting from IntegrationTestExcluderSuite, this test excludes the IntegrationTest category,
  • in addition to the SlowTest category.
    */
    @ExcludeCategory(SlowTest.class)
    public class UnitTestsSuite extends IntegrationTestExcluderSuite {
    }

The extended IntegrationTestExcluderSuite looks like this:

/**

  • This class would not be necessary if @ExcludeCategory could take more than one category!
  • The workaround is to inherit from several suites with one @ExcludeCategory in each one.
    */
    @ExcludeCategory(IntegrationTest.class)
    public class IntegrationTestExcluderSuite extends CategoryTestSuite {
    }

And the base category suite:

/**

  • Base Test Suite for all Category-Based Suites
    */
    @RunWith(Categories.class)
    @SuiteClasses(AllTestsOnClasspath.class)
    public class CategoryTestSuite {

@ajmath
Copy link

ajmath commented Oct 11, 2011

I actually ended up forking and adding the feature myself. Pull request is in.

@merland
Copy link
Author

merland commented Oct 12, 2011

Great. Hope it gets pulled!

@dekz
Copy link

dekz commented Oct 31, 2011

Are you sure that inheritance model actually works, from what I can see it just takes the @Include/Exclude of the TestSuite and doesn't take into account the parent. Reproduced by categorising 2 tests one as A, the other as B. Class X @include A and class Z extend X and @include B. Use X to run the Tests and see it will run the tests with B and not a test only with A,B.

@gaffa
Copy link
Contributor

gaffa commented Dec 4, 2012

I second the demand. Again I am willing to provide the code if you see a chance it is going to be accepted.

@Tibor17
Copy link
Contributor

Tibor17 commented Dec 4, 2012

@gaffa
We are already in progress with this in our pull.
The only thing missing is the Javadoc refactoring.

Pls do not work on a code, because we already agreed a concept and the code is ready including the tests.
So we know use cases and exact behavior and usage which satisfies the needs of people joined the discussions.
We may of course extend discussions if the feature needs to be wider.

I hope we will provide this in next releases.

I would like you to invite into my pull due to the Javadoc and wiki page.

I am very busy with other pull, so your help is welcome in Javadoc.
I am going to finish ParallelComputer by today, thus since tomorrow I will concentrate on Categories again. So I would be happy if we join together.

Do you agree with me?

Thx.

@gaffa
Copy link
Contributor

gaffa commented Dec 4, 2012

Hi Tibor! I am pretty busy working right now. I would have offered a quick solution but your pull request seems to cover more? Its not linked in this thread, is it?

@Tibor17
Copy link
Contributor

Tibor17 commented Dec 4, 2012

@gaffa
Hi again, let's move to #503. But as I said, today is not the best time for me.

@Tibor17
Copy link
Contributor

Tibor17 commented Dec 4, 2012

@gaffa
There were more issues and pulls. Finally we moved only to one. So this is old.
In the #503 you can see the history and backtrack all our activities referring to the issues and pulls.

@marcphilipp
Copy link
Member

Fixed by #503 and shipping with 4.12.

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

No branches or pull requests

7 participants