Skip to content

Commit

Permalink
Update contribution guidelines with unit test policy
Browse files Browse the repository at this point in the history
  • Loading branch information
Christer van der Meeren committed Sep 8, 2023
1 parent 3e2e88c commit c768995
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,23 @@ the following things in mind:
- Unless it's a trivial fix, consider opening an issue first to discuss it with the maintainers.
- For all pull requests, please follow the workflow described below.

### Required unit tests for assertions

When writing tests for your proposed assertions, please take inspiration from tests of similar assertions. For
consistency, the following tests should be used for all assertions:

* One test to verify chaining.
* One test per success condition, including edge cases like `null` subject. The tests could be one or more
parametrized `Theory` tests. If there is a single success condition and no edge cases, it can be omitted since it is
fully covered by the chaining test described above.
* At least two tests per call to `Fail` to verify failure output with and without `because`. Additional tests to capture
all variations of output format, if relevant.
* One test per failure condition, including edge cases like `null` subject. The tests could be one or more
parametrized `Theory` tests. If a `Fact` or a whole `Theory` (not just a test case in a `Theory`) is fully covered by
an output test described above, it can be omitted.
* After tests are written, verify that the tests actually invoke the correct assertion method/overload (easy to miss if
copy-pasting).

### Pull request workflow

1. Fork Faqt on GitHub
Expand Down

0 comments on commit c768995

Please sign in to comment.