But, isn’t the point of unit testing to allow us to test UNITs? Why artificially limit our ability to test units if we don’t need to? If we had the ability to create protected members, wouldn’t we tests those separately?
You see, the more I practice Test Driven Development, the more inclined I am to believe that there are only three reasons for arguing against 100% code coverage.
Continue reading “3 Reasons You Believe 100% Code Coverage Is Impossible”
As you start your journey down the road of Unit Testing you will discover that part of what makes code testable is this concept of Dependency Injection. As you explore further, you will see people mentioning various Dependency Injection frameworks. You may naturally assume that to implement Dependency Injection, you will need to select an use a Dependency Injection framework.
But, Dependency Injection has nothing to do with using a Dependency Injection framework. The frameworks are there because:
1. much of our existing code is code that has too many dependencies and the framework helps us break those dependencies without having to refactor too much of our code and
2. to give us a way to easily swap out one object for another when our code is structured in such a way as to not have dependencies at all.
Continue reading “Dependency Injection Frameworks Are NOT Dependency Injection”
Last week we looked at a few excuses developers give for not testing their code as they develop it (Excuses For Not Testing). We finished that by mentioning that most of the code you write simply isn’t testable. You can’t practice Test Driven Development on something that isn’t testable in the first place.
And there, folks, is why Johnny can’t test.
Continue reading “Why Johnny Can’t do Test Driven Development”
As I started my own journey into unit testing, I slowly began to realize that it was really easy to come up with reasons to NOT test my code as I was writing it, even once I understood what that was supposed to look like. The reason I think most programmers don’t unit test code, once they understand what it is they are supposed to be doing is that they don’t feel like they have permission.
To this I also answer, “How much permission do you need?”
Continue reading “Excuses For Not Testing”