Thanks Andrew, that is an entirely valid comment that I wholly agree with, but would have saved the details for an entire article on its own.
I personally prefer end-to-end tests using Behaviour Driven Development, which I’ve also listed. Unfortunately BDD is not as popular a belief among developers that I wish it to be. Most people think it’s for QA or SDET but that thinking defeats the whole concept.
If I couldn’t do both BDD and unit tests, I’d prefer BDD because it’s the level of testing that affects all stakeholders of the feature directly.
If your code is very algorithmic, then TDD coverage is obviously important. One thing that unit test coverage can do that BDD cannot, is ensuing every if statement ever made, actually gets executed.
Please read my article “Why developers should write their own tests” to see a more detailed opinion. I might write more on the topic in the future.