Generate markdown doc from Gherkin *.feature files
The problem with test documentation is that it is either non-existing or outdated.
We can solve the problem by:
- Adopting BDD approach and Gherkin syntax for test scenario description.
- Using Markdown for documentation.
- Generating Markdown documents from Gherkin description.
- Gherkin syntax is simple and human readable
- Markdown format is easy to publish
- *.feature files become single source of truth for both documentation and test automation.
- Can be easily integrated into any CI/CD process.
Kotlin compiler installed (e.g via sdkman)
-
Put your Gherkin
*.feature
files under./features
folder -
Generate
testplan-ui.md
from*.feature
files by running:$ kotlinc redoc.kt -include-runtime -d redoc.jar && java -jar redoc.jar ./features ./doc/testplan-ui.md
-
Make sure Features section of
./doc/testplan-ui.md
is updated -
Commit and push changes to your git repository
-
Check updated Features section on testplan-ui.md Github page.
-
You should be able to navigate exact lines of
*.feature
files by clicking Scenarios on testplan-ui.md page.
Markdown format does not support comments, so in order to hide autogen markers this workaround is used:
[//]: # (AUTOGENERATED BLOCK BEGIN)
[//]: # (AUTOGENERATED BLOCK END)
However different tools treat such block in a different way. In particular https://typora.io/ adds undesired quotes to this block. There is no reliable way to prevent such behaviour, so beware.