Monday, April 9, 2018

More Integration Tests, Less Mocking, More Linting

Read this great article today by Kent C Dodds


My take away from it is the following:

1. Integration Tests give the best ROI - but people start to write unmaintnable monoliths by getting obsessed with too much code coverage and trying to mock absolutely everything.  On the other hand too much end to end testing results in fragile tests that become up a maintenance issue (see software testing ice cream cone anti-patten).  A focus on integration testing gives the best bang for buck.  

2.  Linting is good - There are lots of good linting tools out there.  You can usually hook them up in with your IDE so they can give you feedback every time you compile.  These will help improve the quality of your code and may help pick up simple bugs that people rely on 100% unit test coverage to eliminate. 

I couldn't agree with this article more.  Especially point 1.  This isn't to say that we don't need some decent unit test coverage.  But lets not get obsessed with 100% or you will find yourself spending so much time writing and maintaining tests that you lose your agility which is the whole thing TDD is supposed to support.