How to do Test Driven Development (TDD) in Java - Tutorial

Test driven development practice has three basic steps

1. Write test first
2. Write the actual program code to make the test pass. Do not do more in this step
3. Refactor the code

Repeat the above steps to achieve your programming goal.


The following picture shows you the TDD cycle.
test driven development cycle

I've created a first episode of a TDD tutorial.



In the above program, i tried to write test cases first in Junit and then the code to make the test pass. Once the test passes, i then refactor the code to make it clean, optimizing the code.
In the episode I of TDD tutorial, i have covered the following test cases of converting the Arabic numerals into Roman:

1. I = 1
2. V = 5
3. X = 10

I hope you've now understood the basics of TDD. In the episode 2, i would cover more difficult test cases of the same program.

Episode 2 is the below video:



The following cases are handled in the above episode 2. 1. L = 50
2. II = 2
3. III = 3
4. IV = 4

Apart from handling the above cases, the refactoring is being done to write an optimized code



Leave your comment



loading
 
 
 
 
All fields are mandatory!

Select your rating:           

 

 

characters left

Powered by Citricle