有没有办法从我打印在文件中的 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