equal
deleted
inserted
replaced
4 Test Driven Development, abbreviated as TDD is a method of software |
4 Test Driven Development, abbreviated as TDD is a method of software |
5 development which banks on the idea of writing test cases that fail for the |
5 development which banks on the idea of writing test cases that fail for the |
6 code that doesn't even exist yet. The actual code is written later to pass |
6 code that doesn't even exist yet. The actual code is written later to pass |
7 the test and then refactored. |
7 the test and then refactored. |
8 |
8 |
9 Writing tests |
9 First "Test" |
10 ============= |
10 ============ |
11 |
11 |
12 Writing a test is simple. Writing a failing test? It is much more simple. |
12 Writing a test is simple. Writing a failing test? It is much more simple. |
13 Let us consider a very simple program which returns the Greatest Common |
13 Let us consider a very simple program which returns the Greatest Common |
14 Divisor (GCD) of two numbers. Since the test cases for the code is written |
14 Divisor (GCD) of two numbers. Since the test cases for the code is written |
15 prior to the code itself, it is necessary to have a clear idea of the code |
15 prior to the code itself, it is necessary to have a clear idea of the code |
74 print "Test failed for the case a=44 and b=19. Expected 1. Obtained |
74 print "Test failed for the case a=44 and b=19. Expected 1. Obtained |
75 %d instead." % tc2 |
75 %d instead." % tc2 |
76 exit(1) |
76 exit(1) |
77 |
77 |
78 print "All tests passed!" |
78 print "All tests passed!" |
|
79 |
|
80 More realistic "Tests" |
|
81 ====================== |
|
82 |
|
83 Now we have completed writing our first test. Let us start writing tests |
|
84 for more realistic |