TDD - In a Nutshell

"One Picture's  Worth Thousands Words"

 image

 Benefits( from my personal experience):
1. Development can be done much quicker. You already jot down all the test cases before writing codes. By that way, you are giving much time in thinking how to solve problem. Codes become much more standard and organized because of the brainstorming.
2. Quality of code is far better and deterministic.
3. Tests are the first class document for how your code will eventually work. Any developer/tester can go through the test cases you covered and get the idea how the system should work in different cases. J Isn’t it too cool ?
4. Easier and risk free to change the code - you just need to run the tests, you will get to know where there might be some problem. 


And so on...

 

4 Comments

  • Is there a large image?

  • Check out the attachment.
    /Adil

  • Hello,

    Is the "New test is Failing?" flow correct?
    When the answer is no its return to "Write a Test..." and if yes its follow to "Add/Update Code".
    It should not be the opposite?

    Thanks,

  • Hi Jacques Marques,
    Thanks for visiting the Blog.
    Actually in TDD, the basic idea is to Add a test (actual codes might not be  there) and run the automated test and to see whether its failing. If it’s failing then write codes to make it pass. This way, incrementally, development is being done. That’s what I tried to map in the diagram.:)
    One point is to be noted – If a new test is added and by itself it’s passing without changing any codes, then there might be something wrong with the unit test or that test is already covered by the code.
    I hope that answer your queries.If you have any comments, please feel free to give me a buzz.
    /Adil

Comments have been disabled for this content.