有没有办法从打印在文件中的Spock测试中获得规范(过滤代码)?
例如,对于以下等级库:
class CarSpec extends IntegrationSpec {
def 'it should not retrieve deleted cars'() {
given: 'a car'
def car = new Car(uniqueName: 'carName')
car.save()
when: 'I delete the car'
car.delete()
then: 'it shouldn't find me the car on the DB'
Car.find { uniqueName == 'carName' } == null
}
}应打印如下内容:
CarSpec
it should not retrieve deleted cars
given a car
when I delete the car
then it shouldn't find me the car on the DB发布于 2012-12-04 04:44:40
您可以使用可用的第三方插件之一(例如https://github.com/damage-control/report),或者编写您自己的Spock扩展(参见https://github.com/spockframework/smarter-testing-with-spock/tree/master/src/test/groovy/extension/custom)。
https://stackoverflow.com/questions/13690778
复制相似问题