Glossary · Automation software engineering and architecture
Test fixture
Also known as: Test context
German: Test-Fixture
In software testing, a test fixture is the fixed, known state and set of objects or data that tests require, set up before each test and cleaned up afterward so that tests are repeatable.
- Software engineering
In one sentence
A test fixture is the known state, objects and data a test needs, set up before and cleaned up after each test for repeatability.
Example
The fixture for the batch tests loads a reference recipe, initializes a simulated reactor at 20 degrees Celsius and clears the event log before each test.
How it applies
- Engineering: Fixtures make tests independent of each other and of execution order. Shared fixtures should be reset reliably, or one failing test causes others to fail.
- Hardware testing: In hardware testing, fixture also means a mechanical device that holds a unit under test. Specify which meaning is intended.
- Documentation: Test documentation should describe fixtures precisely enough to reproduce a test: initial data, configuration and environment.
Test fixture vs. test harness
A test fixture is the prepared state for tests. A Test harness is the infrastructure that runs tests, supplies inputs, captures outputs and reports results.