Reputation: 4781
I pretty much only use JUnit Categories for non-unit tests that I don't want to run as part of the test suite. In NUnit I could use Explicit, but the only thing I've found comparable in JUnit is a Category. In gradle, it's simple to exclude a Category, but I can't figure out how to do this with IntelliJ's test runner. I see how to run tests that belong to a Category, but not how to exclude them.
Upvotes: 12
Views: 1921
Reputation: 4781
Some time has passed since I asked this question, and in that time the Gradle test runner has become the default (at least for me). So though the built-in runner may not have this functionality, you can easily create a gradle task that excludes categories or tags:
test {
useJUnitPlatform {
excludeTags 'integrationTest'
excludeTags 'endToEndTest'
excludeTags 'testDriver'
}
options {
exclude '**/*Integration*'
exclude 'integrationTest'
exclude 'endToEndTest'
exclude 'testDriver'
}
}
Upvotes: 1