Introduction
Incorporating multiple test types into a software test architecture has numerous advantages:
- Readability: easy to understand test architecture and purpose of specific tests through separation of concerns/problem isolation
- Speed Optimization: Different types of tests have different execution speeds, which can be exploited to reduce test development time, see this article.
- Comprehensive Coverage: each test type focuses on a specific area of testing, all of which must be covered.
List of Test Types
The unit tests are the lowest level tests. As you go down the table, the tests become higher level.
Type of Test | Purpose | Scope | Comments |
Unit test | Checks all low-level details of a single, isolated unit. | Single unit, often a single class |
|
Component Test | Verifies that a component running in isolation from other components works as expected. | Single component |
|
Integration Tests | Verifies that communication between two or a few components works as expected. | Small subset of all components |
|
System Tests | Verifies that all software requirements are met. | All components |
|
Exploratory Test | Testing by non-customers of the software to find problems that may have been overlooked. | All components |
|
Acceptance Test | Manually tested by the customer to ensure that all the requirements they've imagined are met. | All components |
Miscellaneous
- Distinct Responsibilities: Each type of test covers a unique scope and provides value, even if two different types of tests cover the same line of code. This is neither duplication nor redundancy. Therefore, multiple test types are needed to provide optimal value for the test strategy.
- Cost and Coverage: Human interaction is costly and fallible. Automated testing, as opposed to exploratory and acceptance testing, minimizes costs and ensures comprehensive coverage without human involvement.
- Test Pyramid: Test types are usually represented in the form of a pyramid, with each type representing a layer. The base is populated by a large number of unit tests, while the top contains numerically fewer high-level tests, reflecting the narrower structure of the pyramid.
- Trends: Low-level tests are more self-contained/isolated, verify fine-granular low-level requirements, detailed/numerous, but still faster to execute, while higher-level tests are more integrated, verify high-level project requirements, fewer in number, but still slower to execute.
- Test Quantities: The higher levels of the testing pyramid require only a fraction of the functionality tested at the previous lower level. For example, unit tests check every use case, including unlikely special cases and invalid arguments, for each individual unit, so they are more numerous. In contrast, the test use cases for a component are often executed against a comparatively small REST API. This means that there are fewer use cases for the component than there are for the aggregate use cases of its individual units, so fewer of the higher-level component tests are required.