@Share
在测试类中,Share标记的变量可以在不同的测试方法中使用。
Spock中的测试方法注解
@Ignore 忽略
- 忽略测试方法
@IgnoreRest 忽略其他
- 忽略其他测试方法
@Unroll 展开数据管道的测试用例
- 展开:数据驱动测试中,展开所有的测试结果,分别显示每个测试用例的测试情况
@FailsWith(ArithmeticException.class) 标记失败
- 记录已经知道的 bug
- 标记让方法执行失败的测试用例
@Timeout(value = 10, unit = TimeUnit.MILLISECONDS) 超时时间设置
- 超时就失败
@IgnoreIf 根据条件忽略
@IgnoreIf({ System.getProperty("os.name").contains("windows") })
def "I'll run everywhere but on Windows"() { ... }
@Requires 根据条件执行
@Requires({ os.windows })
def "I'll only run on Windows"() { ... }
@Retry 重试
@Retry(count = 5)