The No. 1 Unit-testing Best Practice: Stop Doing it!
Date and Time: Feb 07, 2019
This question has been in my mind for a long long time. Long time back, the focus was on testing classes, its methods in isolation which got termed as unit tests.
People were obsessed with 100% coverage. That all resulted in a lot of test code which used to break every now and then as and when class contracts got changed. Resulted in lots of waste.
Move forward and people recognized it and understood problem with class based testing with mocks – https://www.youtube.com/watch?v=EZ05e7EMOLM .
The focus is not rightly on the functionality (behavior) instead of implementation (classes). A change in implementation should not change tests.
James Coplien wrote seminal articles on “Why most unit testing is waste” and people experimented with this idea as well. Cope also mentioned TDD is not the right way to design and provided better alternatives.
In the light of all this how relevant unit tests are and how relevant TDD is?
Let’s learn all that and more.