Testing implementation details is a recipe for disaster. Why is that? And what does it even mean? By Kent C. Dodds.
There are two distinct reasons that it’s important to avoid testing implementation details. Tests which test implementation details:
- Can break when you refactor application code. False negatives
- May not fail when you break application code. False positives
Implementation details are things which users of your code will not typically use, see, or even know about.
So how do you avoid testing implementation details?
A surprising number of people find testing distasteful, especially UI testing. Why is this? There are various reasons for it, but one big reason I hear again and again is that people spend way too much time babysitting the tests. “Every time I make a change to the code, the tests break!” This is a real drag on productivity! The author will explain how described tests fall prey to this frustrating problem.
Follow the link to the full article to learn how do you avoid testing implementation details? Very good read!
[Read More]