问题描述
What is the one most common mistake you make while writing unit tests? Coupling? Lack of cohesion? Try to test too much functionality at once? Not testing enough functionality?
Post some example code if you have an example of that mistake
推荐答案
Not writing them at all.
其他推荐答案
Testing too much in one test. My unit tests often take on more of the character of integration tests by not confining themselves to the method under test.
其他推荐答案
Testing code that is present, rather than code that should be present.
I tend to test code that is present when writing unit tests. That is, I'll write a series of tests that have exceptionally high coverage and test the majority of the code that's present, but misses out on basic error conditions not covered by the code.