renatoathaydes / spock-reports

This project creates a global extension to Spock to create test reports.
Apache License 2.0
273 stars 68 forks source link

Discussion - how to generate feature file #258

Open AnthonyTonda opened 7 months ago

AnthonyTonda commented 7 months ago

Given I have this tests `import spock.lang.Specification

class HelloSpockSpec extends Specification { def "length of Spock's and his friends' names"() { expect: name.size() == length

where:
name     | length
"Spock"  | 5
"Kirk"   | 4
"Scotty" | 6

} } `

When I run the test Then Spock-reports ; HelloSpockSpec.HelloSpockSpec.html, is generated And how to generate the feature file: HelloSpockSpec.feature such as

Feature: HelloSpockSpec

Scenario: length of Spock's and his friends' names Given I have these data | Spock | 5 | | Kirk | 4 | | Scotty | 6 | Then name.side() == length

Thanks

renatoathaydes commented 7 months ago

Spock reports can only generate a summary file containing all specifications in the project, and a separate file for each Specification. The easiest way to generate files for each feature would be to implement that via report templates, as templates are Groovy code which allows you to implement anything in a real programming language.