I would like to learn whether I can specify the @category in gradle test task. So, I can run separately integration junits and the normal junit tests.
I know that there is currently no explicit support for @category in gradle and I am looking for a workaround for this limitation.
The straightforward approach is to define test suits for different test categories, e.g., How to run all tests belonging to a certain Category in JUnit 4. I would prefer to specify @category in my gradle script.
Advertisements. The test task automatically detects and executes all the unit tests in the test source set., Once the test execution is complete, it also generates a report. JUnit and TestNG are the supported APIs. The test task provides a Test.
In versions of Gradle prior to 5, the test. single system property can be used to specify a single test. You can do gradle -Dtest. single=ClassUnderTestTest test if you want to test single class or use regexp like gradle -Dtest.
Support for including or excluding categories has been included in gradle:
test {
useJUnit {
includeCategories 'org.gradle.junit.CategoryA'
excludeCategories 'org.gradle.junit.CategoryB'
}
}
Full documentation: https://docs.gradle.org/current/userguide/java_testing.html#test_grouping
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