I need to run some integration tests and some unit tests and I am using spring, gradle and jUnit 4.
I used jUnit categories @Category(UnitTestCategory.class) and @Category(IntegrationTestCategory.class) and i added
test {
useJUnit {
includeCategories 'org.gradle.junit.CategoryA'
excludeCategories 'org.gradle.junit.CategoryB'
}
}
for gradle in order to include/exclude a category. The idea is that i don't want to mix unit tests and integration test and i have a category for each of them.
The problem is that I must use both spring and categories and @RunWith(...)
can receive only one class param. - RunWith(SpringJUnit4ClassRunner.class)
or @RunWith(Categories.class)
.
I couldn't use @RunWith({Categories.class, SpringJUnit4ClassRunner.class})
and I must run with spring and categories. Plus that in the future i might need to add also other classes not only spring and category. So i need multiple parameters for @RunWith(...)
https://docs.gradle.org/current/userguide/java_plugin.html
Does anyone have a solution please?
Instead of spring runner you can use spring junit rules. Then as a runner you can use Categories
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With