From fc3cd4ea530d7e20d7d7f409b638c205e906aa89 Mon Sep 17 00:00:00 2001 From: mgretzke Date: Tue, 8 Jul 2025 16:42:38 +0200 Subject: [PATCH] added test naming conventions --- CONTRIBUTING.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 95b5244..d28b958 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -127,7 +127,16 @@ Interfaces should be the entrypoint for all contracts. When exploring the a cont ## Testing -The following testing practices should be followed when writing unit tests for new code. All functions, lines and branches should be tested to result in 100% testing coverage. Fuzz parameters and conditions whenever possible. Extremes should be tested in dedicated edge case and corner case tests. Invariants should be tested in dedicated invariant tests. +The following testing practices should be followed when writing unit tests for new code: +- All functions, lines and branches should be tested to result in 100% testing coverage. +- Fuzz parameters and conditions whenever possible. +- Extremes should be tested in dedicated edge case and corner case tests. +- Invariants should be tested in dedicated invariant tests. + +Tests should follow clear naming principles to easily understand the purpose of the test: +- The test itself (or the contract of the test) should include the name of the function it is testing. +- When a test checks for a revert, the test name should start with `test_revert_` or `testRevert`. +- Dedicated fuzz tests should start with `test_fuzz_` or `testFuzz`. Differential testing should be used to compare assembly implementations with implementations in Solidity or testing alternative implementations against existing Solidity or non-Solidity code using ffi.