test driven development

problem:

Code changes over time. How can we, as developers, be sure that as we grow our code base that we do not break code that is already there?

solution!

use testing tools, write code that tests our code so that we do not have to test our code ourselves.

Simple test

// In the code
public static int Sum(int a, int b) {
  return a + b;
}


// in testing file
[Fact]
public void SumTestPositive()
{
  Assert.Equal(10, Sum(7,3));
}
[Fact]
public void SumTestNegative()
{
  Assert.Equal(-10, Sum(-7,-3));
}

koans

 

ko·an /ˈkōän/ noun

a paradoxical anecdote or riddle, used in Zen Buddhism to demonstrate the inadequacy of logical reasoning and to provoke enlightenment.

We will using a testing framework to solve koans and practice problem solving.

test driven development

By Mark Dewey

test driven development

  • 228