Best practices for unit testing
anderseknert opened this issue · comments
Some thoughts
- Extend general advice to recommend test driven development
- And add an "Exceptions" part to the recommendation on imports stating that importing rules directly is fine for tests.
Test section
- Use different package name, and imports, for tests
- Recommendation for naming test packages: same as the package under test, with either
.test
or_test
appended? - Recommendation for naming test files:
_test.rego
suffix?
- Recommendation for naming test packages: same as the package under test, with either
Additionally, I've seen a few questions about how to best organize tests, i.e. should they be in the same directory as packages being tested, or in a separate one? While not strictly about "Rego" the language, I think it makes sense to consider this for the guide as well.