Main Contents

Feel the Pain for Mock Frameworks

jsf, test driven development, software development

Mock frameworks can generate an ‘aha’ moment if you introduce them at the right moment. The evolution looks like this:

  1. Introduce unit testing as a concept.
  2. Walk through the basics of an xUnit framework.
  3. Introduce test driven development.
  4. Introduce fake objects or hand rolled stubs to substitute for things like DAOs.
  5. Use specialized mock object libraries like Shale mock JSF framework to build fake FacesContexts.
  6. Spring EasyMock or JMock on them to handle some nasty edge cases.

We choose EasyMock. Introducing it right up front would have been cognitive overload. Getting TDD installed is really more a journey than a simple prescriptive plan. TDD is about changing a core developer behavior in how they write code. So I saved the mock framework explanation for that moment where it elegantly solved the problem at hand.

Ed Gibbs @ April 16, 2007

3 Comments

  1. Aaron Korver April 17, 2007 @ 11:29 am

    The best time to introduce something new is when there is a pain. People are more inclined to listen when they know they hurt, than when they feel good.

  2. Ed Gibbs April 17, 2007 @ 8:41 pm

    When they feel good they explain how they can just deploy it and debug it on the server, no need to write the stinkin’ tests.

Leave a comment


Feed