问题
We're building up a specification in Gherkin, and we'd like to present the feature files to the business stakeholders. How can we export all our feature files in some sort of 'pretty' format?
For example:
- Generate a document containing all features
- OR integrate features into other documentation
- OR publish the feature files on a web portal (nicely formatted)
回答1:
The best I've seen so far is Pickles; http://github.com/picklesdoc/pickles
It's work in process but looks good already. Please supply your feedback on GitHub
回答2:
Our team is currently using relish, a code project to nicely format your gherkins onto a website.
It does however have some drawbacks - it is only "free while in beta", but this might still give you some ideas.
A nice feature of relish is that your dev team can choose to push the gherkins whenever they are ready, and the stakeholders don't need to manage/receive new emails / documents etc - they can just refresh the project webpage.
回答3:
Why do you think you want to do this?
I would suggest that the beauty of bdd is that it provides a ubiquitous language between business stakeholders, testers and developers. It can be used at any part of the testing cycle to describe the features you want and the scenarios they adhere to. With your gherkin style feature file as a simple text file, it can be edited directly by a business stakeholder and transferred straight back into a source code repository. You can literally take new scenarios from the business and confirm which features need work, before writing one line of code.
By providing a different format for these files you are interfering with the ease at which data can cross those bridges. Yes you can prettify it and group all of the features together, into a word document etc, but by doing that you lose the ability to directly take a set of scenarios straight from the business and demonstrating that the codebase "works" for them.
So, I would suggest that the best format for presenting to the business stakeholders is exactly the same as the format they are already in.
However, have you considered changing your runner of your tests. Even if the features are still in plain text, a runner such as concordion or Concordion.net will give you a very pretty display of a test run.
回答4:
Another option which requires no technical skill whatsoever. Similar to another answer on here, but is specifically designed to appeal to the business rather than technical stakeholders. It's a Chrome extension which auto formats any *.feature file opened in Chrome. See examples and install here: Pretty Gherkin feature file viewer
回答5:
Have a go with Gherkin Viewer
I put together this chrome extention for this purpose as I didn't like the idea of exporting / republishing feature files. This allows you to view the original source truth :)
https://chrome.google.com/webstore/detail/gherkin-viewer/lfckgakamnfdbanfefglincnckfnlapp?hl=en-GB
Take a look, see if it works for you. Source is on GitHub, very basic start if anyone would like to contribute be greatly appreciated.
来源:https://stackoverflow.com/questions/8049267/pretty-output-of-gherkin-feature-files