unit_test
This is an old revision of the document!
Table of Contents
Source: Software Testing course at ITMO university by Kochubeev Nikolay Sergeevich
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.
Test doubles are used to ensure Unit tests are truly isolated.
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
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.
Popular testing frameworks
- JUnit (Java) – standard in the ecosystem, annotations, parametrization, Maven/Gradle and IDE integration.
- NUnit (C#) – flexible attributes ([TEST], [TestCase]), rich assert set.
- xUnit (.NET Core) – [Fact]/[Theory], modern style, .NET CLI integration.
- Go Testing (Go) – built-in, minimalistic, table-driven tests.
- pytest (Python) – fixtures, marking, parametrization, simplicity.
unit_test.1757435412.txt.gz · Last modified: by plida
