Demo project for JUnit & Spock test grouping using JUnit 5 tags.
Spock
- Assigned at the class level to all tests in src/test/groovyJUnit
- Assigned at the class level to all tests in src/test/javaMultiply
- Assigned to all tests testing the Multiply.javaDivide
- Assigned to all tests testing the Divide.java
./gradlew test
./gradlew test -Dgroups=Spock
./gradlew test -Dgroups=JUnit
./gradlew test -Dgroups=Multiply
Note: this example is using JUnit tag expressions, support for exclusions could be built out by parsing the
groups
parameter and leveraging theexcludeTags
configuration within build.gradle.
./gradlew test -Dgroups="Multiply | Divide"