Home » 2015 » March

100% Code Coverage Possible?

100% code coverage

In response to my post “Excuses For Not TestingKris K asked:

There is also another side of Unit Tests. Some companies are so fixated they aspire to have 100% Unit Tests coverage and they make programmers write Unit Tests for legacy code for no reason. Just for the sake of having Unit Tests. … [I] wonder if you had any similar experiences and what you think about this approach. I guess the 100% extreme is better than no tests at all, but it can make the developers very bored and feeling useless.

And my initial reaction to this was, “WOW!  So much to respond to here.  I think this is worth a blog post. Continue reading “100% Code Coverage Possible?”

Changing Habits

hand-039This past week I’ve been thinking a lot about changing habits and how much of our lives habits influence.

To be clear, I would define a habit as something we have learned to do as an automated response to some trigger.  Something we no longer think about doing, but we just do because … well … because we’ve always done it that way.

I have some bad habits:

  • Eat something sweet when I’m tired or bored.
  • How I react to particular situations
  • … others I’m not so willing to share publicly …  🙂

And some good habits:

  • Wake up before 4:40am
  • Go to bed at 9:00pm
  • Write a blog post once a week
  • Watch PluralSight videos for 30 minutes every day.

And some habits I’m trying to form:

  • Exercise every day
  • Take my vitamins
  • Work on my book for 30 minutes each day

Continue reading “Changing Habits”

Dependency Injection Frameworks Are NOT Dependency Injection


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”

Why Johnny Can’t do Test Driven Development

ppl-kid-05Last 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”