Search code examples
testingspecificationsspockspock-reports

Is documentation readable by non-programmers possible with Spock?


FitNesse has a wiki-style documentation feature. It provided both the code and the doc's for these specification tests.

Is there a way in Spock (with plugin? / out of the box?) to generate any type of similar documentation to show off to the project managers / stakeholders, who can not be expected to read the (Groovy) source code of the Spock specifications.


Solution

  • Spock allows you to add descriptions to blocks, e.g.:

    when: "5 dollars are withdrawn from the account"
    account.withdraw(5)
    
    then: "3 dollars remain"
    account.balance == 3
    

    While we don't use this information yet, it's easy to access from an extension (see link below). What's left to do is to turn this into a nice report.

    https://github.com/spockframework/spock-uberconf-2011/blob/master/src/test/groovy/extension/custom/ReportExtension.groovy