从 Spock 迁移到 2.0 和 Groovy 到 3.0.7 @Category 测试未执行后
After Migration from Spock to 2.0 and Groovy to 3.0.7 @Category tests not executed
迁移设置
Spock 版本 - 2.0-M5-groovy-3.0
jdk 版本 - 11
Maven surefire 插件版本 - 3.0.0-M5
Maven 版本 - 3.8.0
我有一个标记界面和 Spock 2.0 测试如下
`
interface RestTests {}
`
```
@Category(RestTests)
class SimpleTest extends Specification {
def "should should” perform simple test”() {
given:
// …..
}
}
```
当我运行
```
./mvnw clean test -Dgroups=com.api.test.categories.RestTests
```
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.6:report (jacoco-report)
@Category
是一个 junit4
特性,Spock 2.0 是 JUnit 平台上的一个合适的 TestEngine
,请查看 Spock 文档的 Include and Exclude。提示:这是一个 groovy 文件,因此您可以根据需要添加逻辑。
如果你想在 JUnit5 中使用组,你必须阅读 https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html the chapter "Filtering by Tags" and use the annotation @Tag, see https://howtodoinjava.com/junit5/junit-5-tag-annotation-example/
迁移设置
Spock 版本 - 2.0-M5-groovy-3.0 jdk 版本 - 11 Maven surefire 插件版本 - 3.0.0-M5 Maven 版本 - 3.8.0
我有一个标记界面和 Spock 2.0 测试如下
`
interface RestTests {}
`
```
@Category(RestTests)
class SimpleTest extends Specification {
def "should should” perform simple test”() {
given:
// …..
}
}
```
当我运行
```
./mvnw clean test -Dgroups=com.api.test.categories.RestTests
```
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.6:report (jacoco-report)
@Category
是一个 junit4
特性,Spock 2.0 是 JUnit 平台上的一个合适的 TestEngine
,请查看 Spock 文档的 Include and Exclude。提示:这是一个 groovy 文件,因此您可以根据需要添加逻辑。
如果你想在 JUnit5 中使用组,你必须阅读 https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html the chapter "Filtering by Tags" and use the annotation @Tag, see https://howtodoinjava.com/junit5/junit-5-tag-annotation-example/