Methodologies

TDD – three letters, that will make your software more stable

Let’s talk a little bit about TDD today. What’s that, how to make it work and what’s connected with introducing it into your day to day development? I will explain it to you in this post using  three colors: red, green and refactor (I will explain later). I wish you a pleasant reading.

TDD refers to Test Driven Development, which is one of methodologies of software development. It allows us to have 100% test coverage. That thing is pretty important! Remember one sentence: what was tested during development, does not get back to us from production stage. Of course if tests were written properly and of course they cover all of existing cases (which is possible in real life nearly never, but it is worth trying), because clients always find a way to find a bug (or not predictable feature).

Let’s get back to our “colors” now.

redGreenRefactor.jpg

In TDD approach we define three colors, which are correlated with three repetitive steps, that are taken during development process:

  • red – write automatic tests, that fail, because of lack of functionality in code
  • green – implement functionalities, so that tests pass
  • refactor – change written code to keep up with development principles like DRY and KISS

When it is done you have to start again with writing new tests (that fail at the beginning of course) and so on and so forth. That’s the the crème de la crème of TDD. It allows you to have always everything well tested and to write code, that meets expectations and specification from clients.

 

 

Advertisements

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