Why you should write tests last

Prompted by Szczepan’s post.

I have written tests after code when

  • the code is already there, but I / others don’t know what it does or how to use it, and we need to
  • I wrote a spike which turned out to be pretty good code, and I wanted to describe what it does and how to use it
  • I realised I needed to add some simple yet important behaviour while making a different test pass, and forgetting to add the code would possibly introduce serious bugs, so I added it as I went along and now I’m going back to show what it does and how to use it
  • I was learning how to write the tests first, and wanted to know what they would look like.
This entry was posted in bdd. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s