-
Notifications
You must be signed in to change notification settings - Fork 0
Testing Guidelines
We ask developers to run existing tests and to provide tests for their contribution for two main reasons:
- The code they add should not break existing code
- Future modifications should not break their contribution
In this context, we ask contributors to follow these guidelines:
- make sure that existing tests still pass after having added their contribution
- update existing tests if they need to be adapted
- add tests for their contribution (expected coverage for new code is 80%)
- test method names must follow expected naming scheme (see below)
- if a test needs to assert multiple conditions that need to be considered as a whole, use assertj's
SoftAssertions - if there is the need to add a third party test library, please first discuss with us in order to make sure that we agree on the library and on the version to be used.
- if there is the need to change a test library version, please first discuss with us in order to make sure that we won't introduce compatibility issues
What we do not ask developers to do (but help is really appreciated):
- add missing tests for preexisting code
We want to have our unit test methods self explanatory and as clear as possible. Therefor contributors must respect the following convention:
// when testing a SUT's constructor
<class name>_(when|with|using)_<whatever you want>_should(Not)?(Throw)?_<whatever you want>
// when testing a SUT's method
<tested method name>_(when|with|using)_<whatever you want>_should(Not)?(Return|Throw)?_<whatever you want>
// when testing a SUT's constant
constant_<tested constant name>_should(Not)?_<whatever you want>
While using _ instead of lowerCamelCase may seem ugly at first sight, using this convention for test methods brings two advantages:
- test methods are nicely ordered in your IDE's class overview
- when a test fails it is extremely easy to know what method has been impacted
QualInsight contribution guidelines by Michel Pawlak is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Permissions beyond the scope of this license may be available at http://www.qualinsight.com/.
- Home
- Contribution Process
- Guidelines
- Architecture
- Development
- Error Handling
- Logging
- Documentation
- Testing
- Maven
- Commit
- Pull Request
