This is an example setup for a zephyr based application alongside unit, integration and system tests defined in a BDD manor.
Lets get python setup.
$ python3 -m venv .venv
$ source ./.venv/bin/activate
$ pip install -r requirements.txt
.
├── app
│ └── src
| └── (code base specific to creating the target application linking to main source code)
├── doc
├── src
| └── (main code base for application)
└── test
├── integration
| └── src
├── system
│ └── features
└── unit
└── srcTLDR: Bulid the docs
chmod +x build-docs.sh
./build-docs.sh
strictdoc is used to capture requirements and thier parent-child relationships.
As an example in doc/urs there is a urs.sdoc file which documents the user requirements for the system. Given changes to the sdco files they can be exported using:
strictdoc export .
Want to auto-enumerate new requirements? call the auto-uid using:
strictdoc manage auto-uid .
If you want to view the html generated its best to use the test server:
strictdoc server .
Formal requirments are good for interfacing with others; teams, users, project managers. However the with an agile aproach we can take user stories and describe them as features with a given expected behaviour.
These are gherkin files!
By describing fetaures in this way, automated test tools can parse them and match against test steps. We then have an executable specification, where the results can verbally describe the behaviours and features tested.
BDD can be used at system, integration (sub-system) and even unit test levels. What matters is the context and level of detail.
- strictdoc Formal documentation tool that supports referencing.
- sphinx_gherkindoc processes gherkin files and creates sphinx based rST files that can be merged in with other documentation such as StrictDoc or just plain old sphinx. Combined sphinx can be used to generate html, PDF or other supported output formats.
- cucumber-cpp allows gherkin files to be matched agsinst steps written in C++. These steps could easily be used to integrate with C or C++ code under test. Most useful for unit testing from gherkin files. It can be used with gtest or boost.
- ceedling A test framework for C supporting mocking etc. But no BDD support from gherkin files directly.
- catch2 A simple test framework for C++. BDD MACRO support, but no BDD support from gherkin files directly.
- behave A test framework written in python operating on gherkin files. The matching python steps can be used to automate simulated or embedded targets.