Sunday 16 February 2014

Test Driven Development



Write the tests before development. Gradually correct the failed tests by writing implementation code.

So overall quality of code is good and is according to requirement specification.

It also reduces programmers debugging effort. Tests produced helps in improving readability and understanding of code.

Testing and Good Design are related. So It also improves overall Design.

How To Identify Tests

1. Identify tests with +ve / correct outcome
2. Identify tests with -ve / incorrect outcome
3. Identify tests which may cause exception i.e Destructive tests.

For example , sum(int a,int b) where a,b are +ve integer.
Tests
1. sum(5,7)
2. sum(-5,7)  -ve integer input is invalid
3. sum(null,null) null is not integer

There are various benefits and shortcomings of test drive development. So make sure that it fits proper in your development process before using it.

No comments:

Post a Comment