Extract specifications from Spock specifications

Is there a way to get specifications (code filtering) from my Spock tests printed in a file?

For example, for the following specification:

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
    }
}

should print something like:

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
+3
source share
1 answer

You can use one of the available third-party plugins (for example, https://github.com/damage-control/report ) or write your own Spock extension (see https://github.com/spockframework/smarter-testing-with-spock / tree / master / src / test / groovy / extension / custom ).

+4
source

Source: https://habr.com/ru/post/1527754/


All Articles