[QA.FT.1] Ensure individual component functionality with unit tests
Category: FOUNDATIONAL
Unit tests evaluate the functionality of one individual part of an application, called units. The goal of unit tests is to provide fast, thorough feedback while reducing the risk of introducing flaws when making changes. This feedback is accomplished by writing tests cases that cover a sufficient amount of the code. These test cases run the code using predefined inputs and set expectations for a specific output.
Unit tests should be isolated to a single class, function, or method within the code. Fakes or mocks are used in place of external or infrastructure components to help ensure that the scope is isolated. These tests should be fast, repeatable, and provide assertions that lead to a pass or fail outcome. Teams should be able to run unit tests locally as well as through continuous integration pipelines.
Ideally, teams adopt Test-Driven Development (TDD)
Related information: