News for hackers. Stuff that matters.
Re:Unit Tests Considered Harmful by taylodl on Friday April 12, 2024 @10:09AM (#40013104)
Your unit tests should be contravariant to the code its testing so that way your code can be refactored and your existing unit tests can be used AS-IS to test the refactored code.

The Fragile Test Problem arises when your unit tests are covariant to the code its testing, such that a significant refactor breaks the tests - not because the code is necessarily wrong, but the structure of the code is no longer what the unit test was expecting.

There are no comments on this comment yet.