General Guildlines
- Create Class tests preferably using Hamcrest for legibility.
- Be through in creating differing tests.
- No test for methods to simple to fail (e.g setters and getters)
- Test positive and negative results
- Tests should run in isolation – if there are dependencies use mocking.
- Test Exceptions
- Create parameterisation tests for suitable methods.
- Tests should serve as sample code & documentation
- Write Test Documentation
- Routinely check Architectural boundless
- When refactoring keep changes small then retest.
- Minimalise comments, instead use descriptive naming.
Use RGR cycle
- Write test using the RGR cycle
- Write a failing test (Red)
- Write the code so the test passes.
- Re-factor your code, improve, document
- Check Structure, remove complexity
- Legibility – e.g Method Extraction
- Check for Anti-patterns
- Check for coupling
- No local variables
- Methods should not be more than 10 lines of code.
- Where applicable use dependency injection
- Cycles should not be longer than 5 minutes or ten lines of code.
Last Update 24/2/19