Tuesday, September 11, 2007

Too many mocks?

As I write tests, I use mocks to push off behavior that is difficult to test. This pattern helps me focus on the class under test and drives my design.

At what point can you push too far?

With TDD, its all about your tests, so anything that helps you write a test is the right thing to do. I am confident the tests drive a good design.

However, sometimes there are border cases. You may wonder if another class is excessive.

In this case ask a simple question: is this behavior the single responsibility of this class?

Usually the answer is no. The behavior I'm testing is combination of responsibilities and so, yeah, a mock is a good choice.

3 comments:

Unknown said...

Do you physically go to locations and train for Certified Scrum Master certification or do you know of anyone? I am in South Florida.

Thanks,
August

wendy said...

August,
The best resource to find a class to get Scrum certified is the Scrum Alliance. The site has a list of upcoming classes, teachers and locations.
Good luck.
-Wendy

Fırat Birlikbaş said...

Hi ! My name is FIRAT. I'm a programmer! I was looked your blog and I wanted meet you. Please reply!

My english not good I'm sorry :(