Test Driven Development

On today´s post, we are going to talk about another way of development which kind of goes backwards, this is Test Driven Development (TDD). Test Driven Development consists of writing the tests first, then writing the source code that passes the test successfully and finally refactoring the written code. This methodology sounds kind of atypical, but with this type of practices you actually get a more robust, safer, and more maintainable code with faster development.

Check the Mic
Check the Mic flickr photo by Philip Dehm

TDD was created by Kent Beck (who also invented Extreme Programming and JUnit), and in essence, it is a process to follow, which already makes it different from a simple testing approach. Something really important to point out is that TDD is not for testing primarily, rather a practice that involves development as a whole, especially in software design.

How do you do it?

if you combine the software process design with TDD and agile methodologies, here are the steps to follow:

  1. The client writes his user story.
  2. The acceptance criteria of this story are written together with the client, breaking them down to simplify them as much as possible.
  3. The simplest acceptance criteria is chosen and translated into a unit test.
  4. It is checked that this test fails.
  5. The code that passes the test is written.
  6. Se ejecutan todas las pruebas automatizadas.
  7. The code is refactored and cleaned.
  8. All automated tests are passed again to verify that everything is still working.
  9. We return to step 3 with the missing acceptance criteria and repeat the cycle again and again until our application is complete.

(The pure steps for TDD are 3,4,5,6,7,8,9)

Backwards
Backwards flickr photo by John Foster

Summary.

Test driven development can be defined as a test oriented design cycle where you create software in relation with the minimal requirements guided by tests that ensures a functional system as well as robust code in short time.

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

Blog at WordPress.com.

Up ↑

Create your website with WordPress.com
Get started
%d bloggers like this: