开发者

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.


Well, I have used the Strings that describe each Spock block in your tests to generate HTML reports. Please visit my project and let me know if that helps:

https://github.com/renatoathaydes/spock-reports

You can download the jar from the reports directory and then just add it to your classpath. Run your tests, and "miraculously" you will have reports generated in the directory build/spock-reports!

You can even provide your own CSS stylesheets if you want to customize the reports, as explained in README.

Here's a blogpost I wrote about writing this Spock extension.

UPDATE

spock-reports has been available on Maven Central for a while now, as well as JCenter.


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


There are some great answers in here already, but if you want to keep your BDD definitions free from any plumbing whatsoever, you can take a look at pease, which will let you use Gherkin specification language with Spock.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜