unit_test
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| unit_test [2025/09/03 13:23] – plida | unit_test [2025/09/10 07:04] (current) – plida | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | Source: Software Testing course at ITMO university by Kochubeev Nikolay Sergeevich | ||
| + | |||
| ====== Unit tests ====== | ====== 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. | + | 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. They' |
| + | ==== Concepts ==== | ||
| + | |||
| + | [[test_doubles|Test doubles]] are used to ensure Unit tests are truly isolated. | ||
| + | |||
| + | [[testing_factory|Factories]], | ||
| + | |||
| + | [[property-based_testing|Property-based testing]] is an approach to testing in which we test the properties of a function rather than individual examples. | ||
| + | |||
| + | [[data-driven_testing|Data-driven testing]] is an approach in which one test function is executed multiple times with different sets of input data. | ||
| + | |||
| + | [[fixture|Fixture]] is a defined and reliable context for the tests. | ||
| ==== Benefits ====== | ==== Benefits ====== | ||
| Line 13: | Line 26: | ||
| ==== Principles of good unit tests ==== | ==== Principles of good unit tests ==== | ||
| - | * **FIRST:** Fast, Isolated, Repeatable, Self-validating, | + | * **[[first|FIRST]]:** Fast, Isolated, Repeatable, Self-validating, |
| - | * **AAA:** Arrange, Act, Assert; | + | * **[[arrange_act_assert|AAA]]:** Arrange, Act, Assert; |
| - | * **GWT:** Given-When-Then. | + | * **[[given_when_then|GWT]]:** Given-When-Then. |
| ==== Pros and Cons ==== | ==== Pros and Cons ==== | ||
| Line 28: | Line 41: | ||
| * require support with changes to API; | * require support with changes to API; | ||
| * do not find integration errors. | * do not find integration errors. | ||
| + | |||
| + | ==== Popular testing frameworks ==== | ||
| + | |||
| + | - **JUnit** (Java) -- standard in the ecosystem, annotations, | ||
| + | - **NUnit** (C#) -- flexible attributes ([TEST], [TestCase]), | ||
| + | - **xUnit** (.NET Core) -- [Fact]/ | ||
| + | - **Go Testing** (Go) -- built-in, minimalistic, | ||
| + | - **pytest** (Python) -- fixtures, marking, parametrization, | ||
| + | |||
| + | |||
unit_test.1756905832.txt.gz · Last modified: by plida
