3 ms·
I went through a phase of this when I started writing automated tests. It occurred when I started using a mocking library for the first time. The library was
by tieTYT 13y ago
I went through a phase of this when I started writing automated tests. It occurred when I started using a mocking library for the first time. The library was so advanced I could basically test my implementation instead of my api. EG: "first you call foo.bar(), then you call foo.baz()" As a result, my test and my system under test looked very similar.
I'm not sure if you're in the same situation I was in, but let me tell you: My situation was an anti-pattern. All I was testing was that my code does what it does. I wasn't testing that my code was working.
Make sure you're not making the same mistake. If you are, a symptom would be that lots of tests fail when you're only refactoring.
- prawks 13y agoNot quite, but I get what you're saying for sure. I think jacquesm said it well in his reply to me that you're more testing the "contracts between two pieces of code right at the interface", and it shouldn't be any deeper than that to avoid what you're describing. The symptom of many tests failing during refactoring is something I'll be keeping in mind, however.