Last week in our TDD Study Groups was mocks and stubs and how to effectively utilize them along with TDD.
Readings
Mocks Aren’t Stubs
- How tied is our knowledge (the difference between Fake, Dummys, Stubs and Mocks) to our current framework?
RhinoMocks.Automocker Discussion
Is this a good thing? It seems to be hiding the pain of how hard it is to set up our tests – which for us tends to mean that the class is doing too much. Wwe need to separate our concerns when setting up tests is painful.
Our Form Models, for example, have some Drop-Down lists that query the database for the items they need to show. Why can’t we take that responsibility from them and move to more basic, give me what I need to show, pattern..
Are you a Mockist or a Classical Tester?
- Mockists: 2
- Classical: 1
- Self-Loathing Mockist: 1
Using too many mocks leads to being too tied to the implementation.
But then using too few mocks could lead to brittle tests.
Interface Discovery
Found that this is one of the major advantages to utilizing TDD. Due to the test-first approach, how you use a function is one of the first concerns while writing code. We’ve found this leads to a cleaner interface to use
Give Me More!
If this is your first viewing on week 2, you can look over at what we did for Week 1 here.
Also, there should be a new post up next week for week 3 where our focus will be more on Mocks and Stubs.