unit_test
This is an old revision of the document!
Table of Contents
Unit tests
Unit tests check individual units of software (be it functions, methods or classes) in isolation from the rest of the system. The goal is to ensure that every module works as intended.
Benefits
- Units tests ensure quick feedback.
- They give confidence in refactoring.
- They document code's behavior.
- They can help find errors at the early stages.
Principles of good unit tests
- FIRST: Fast, Isolated, Repeatable, Self-validating, Timely;
- AAA: Arrange, Act, Assert;
- GWT: Given-When-Then.
Pros and Cons
Pros:
- quick feedback;
- behavior documentation;
- fast completion.
Cons:
- do not test module interaction;
- require support with changes to API;
- do not find integration errors.
unit_test.1756905832.txt.gz · Last modified: by plida
