"Unit tests are inherently tied to the way code is implemented." - no, but that's the crux of the issue: how most people write tests makes them tied to the implementation. Suppose you're testing a function that anonymizes data - if you write a test so that it checks a for a specific value, you're tied to the implementation and you can't choose a different anonymization algorithm. Instead you should be testing for properties that are expected of this function (a.k.a. "behavior") that client code relies on. 1/2
↧