General Fixture

The general fixture smell occurs if test classes contain broad functionality in the implicit setup, and different tests only access part of the fixture.

Problems caused by a general fixture are two-fold: firstly, the cause-effect relationship between fixture and the expected outcome is less visible, and tests are harder to read and understand. This can cause tests to be fragile: a change that should be unrelated affects tests because too much functionality is covered in the fixture. Secondly, the test execution performance can deteriorate, and test execution times may eventually lead to developers avoiding to execute tests.

Reference

A. van Deursen, L. Moonen, A. Bergh, G. Kok, “Refactoring Test Code”, Technical Report, CWI, 2001.


Test Smells

Home

All rights reserved (c) Tushar Sharma 2017-23.