Monday, December 1, 2008

Unit Test Ice Breakers

So you're looking at this pre-existing code. You aren't sure what to do with it, but you need to get some unit tests going. What do you do when you get stuck.

  • Start by testing you can instantiating the class.
  • Test that you can call the function at all.
  • Pick the easiest bit of functionality.
  • Write the name and assertion first.
  • Write the function call as you would like it to appear.
  • Refactor the existing tests.
  • Pick the most interesting bit of functionality.
  • Switch partners.
  • Read the code for obvious flaws.
  • Rerun the AT
Again, this is part of the work being done by myself and Jeff Langr.

No comments:

Post a Comment