Guidelines for automated test contributions
Contribute to DKGv6 by growing the automated test suite for the ot-node!
Welcome to the automated tests contribution guidelines! By contributing to ot-node automated test suite, you help further the progress of OriginTrail technology development and increase the robustness of the DKG implementation. Detailed instructions on how you can participate are described below, however if you need any assistance feel free to jump into Discord and ask for help from the community or core developers there.
This guide applies to the DKG node Github repo, particularly for the v6 branches (v6/develop being the default branch). If you are creating a contribution, branch off from v6/develop.
We use Cucumber.js for running automated tests. This framework uses the Gherkin language, which allows expected software behaviors to be specified in a logical language that can be easily understood.
For a detailed guide on how to write BDD scenarios, visit Cucumber docs.
Tests need to cover errors listed in github discussions page. Different errors are thrown in different commands, all of which are executed by the command executor. To learn what the command executor is and how it works, please visit Command Executor.
Steps to contribute BDD tests
Check out github discussions to see current test requirements. Check out the existing steps available in
./ot-node/test/bdd/steps
.Create a feature file where you'll define new scenarios. Features should be located in test/bdd/features directory with the appropriate file name format: <operation>-errors.feature (e.g. publish-errors.feature, get-errors.feature).
When you're done with the scenarios that you've created, following the Contribution Guidelines, create a draft PR and tag at least two core developers (and as many other community members as you wish). The team members will review the feature files and either give approval or request for changes. Once you get a confirmation that the feature files are satisfactory, you can continue with corresponding step definitions. This helps provide feedback on the contribution early on.
Put step definitions in the
./ot-node/test/bdd/steps
directory.Implement the steps and ensure that both old tests and the new ones you just created are passing locally (use the
npm run test:bdd
command). Node logs can be found in ./ot-node/test/bdd/log/<scenario-name>/origintrail-test-<index>.log(e.g. test/bdd/log/Publishing-a-valid-assertion/origintrail-test-0.log).When you're satisfied with the scenarios and their step definitions, you may now mark your PR draft as "Ready for review".
There will likely be feedback on your PR before it gets approved, so make sure to follow the status of your PR contribution. After PR approval, your changes will be merged.
Congratulations! You've just made ot-node more robust 🎉
Last updated