Testing Standard
Purpose
In software engineering, quality is important. What is the best tool for quality ? Tests !
Test driven development (TDD)
See Wikipedia
- 3 STEPS : RED,GREEN,BLUE
- RED : write a test that describe the problem
- GREEN : write the code that solves the problem
- BLUE: refactor / clean
- F.I.R.S.T. Unit Tests : Fast, Isolated, Repeatable, Self-Validating and Thorough
- EXPLICIT Tests should be written in a way that any developer should understand what the target code is doing (Tests are documentation)
- Given, When, Then testing style is recommended
- ONE BUG = ONE NEW TEST - A bug is a use case not handled by the system. Therefore, to check that a bug was fixed, there should be a test corresponding to that new case.
- USAGE DRIVEN : The more a piece of code is or will be reused, the more tested the code must be.
- IMPACT DRIVEN : If the consequences of a bug on a piece of code could be catastrophic, then there should be tests