Second Test

I figure now is as good a time as any to try my second test.

  • I add in the test 2 = “II” and copy the C and D formulas from the existing row

So, now I have my 2nd test and it is failing. It might not feel like it, but this is good. Very good!

It’s the rhythm of TDD – write a failing test, make it work using the simplest way possible, then refactor (i.e. tidy up) the code.

I reckon I know how to fix up this code.

  • After a quick peek in the Excel help files on the “if” statement, I change the code

Public Function i2r(i As Integer) As String


If i = 1 Then

i2r = "I


i2r = "II

End If

End Function

  • Then I switch across to Excel and press F9 to recalculate.

Two passing tests! I’m on a roll. Now, let's add some more tests.