tag:blogger.com,1999:blog-6628985022531866193.post6964825033082421264..comments2024-02-12T17:37:05.629+00:00Comments on The OldWood Thing: Overly Prescriptive TestsChris Oldwoodhttp://www.blogger.com/profile/18183909440298909448noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-6628985022531866193.post-18507799060430775912016-11-17T21:35:56.556+00:002016-11-17T21:35:56.556+00:00Well said.
I failed at this early on and am still ...Well said.<br />I failed at this early on and am still fighting my way out of tests which are massively overly detailed...<br /><br />BUT, I sometimes also quite like the way the overly detailed tests can catch things that I don't expect them to catch. My (hand crafted) mocks are generally a bit too noisy and simply log interactions (all interactions) and so things break when these interactions change... Mostly it's a pain and I try and move away from it or refactor so that the interaction is checked in one place rather than in each test...<br /><br />BUT, sometimes these interactions catch things that I've no other way to catch. I have mock reference counted objects that have caught leaks because they're so noisy. I have mock locks which have caught potential deadlock because they're so noisy.<br /><br />I'm torn between tearing out the noise and putting more in. Depending on which angle I'm coming at it from... Updating the code and finding that I need to change loads of tests just because I fiddle with a parameter object in a slightly different way but the outcome is the same; I want to simplify and quieten the mocks. Fixing a bug where a noisy mock has announced that I've just checked in a change that meant we're leaking an object in one specific scenario; more noise please...<br /><br />Of course, the danger with the noise, if you don't try and remove it, is that you just assume the new noisy behaviour is correct rather than spending the time to determine if it is correct or broken; updating the tests with new noise to pass even though you haven't worked out if the new noise is good or the old noise was correct... Then the noise has no value.Len Holgatehttps://www.blogger.com/profile/09999916557649067599noreply@blogger.com