Test-Driven Development

LispUnit

lisp-unit is a Common Lisp library that supports unit testing

Unit Testers Get More Chicks

My belief is that unit testing is for everyone and, in fact, I’ll go so far as to say that I believe becoming a test-driven developer is the single best change a programmer can make in their day to day routine.

TDD/BDD in Ruby - Chapter 7

To-Do List

$5 + 10 CHF = $10 if rate is 2:1
$5 * 2 - $10
Make "amount" private
Dollar side effects?
Money rounding?
equals()
hashCode()
Equal null
Equal object
5 CHF * 2 - 10 CHF
Dollar/Franc duplication
Common equals
Common times
Compare Francs with Dollars
Currency?

TDD/BDD in Ruby - Chapter 6

To-Do List

$5 + 10 CHF = $10 if rate is 2:1
$5 * 2 - $10
Make "amount" private
Dollar side effects?
Money rounding?
equals()
hashCode()
Equal null
Equal object
5 CHF * 2 - 10 CHF
Dollar/Franc duplication
Common equals
Common times
Compare Francs with Dollars

TDD/BDD in Ruby - Chapter 5

To-Do List

$5 + 10 CHF = $10 if rate is 2:1
$5 * 2 - $10
Make "amount" private
Dollar side effects?
Money rounding?
equals()
hashCode()
Equal null
Equal object
5 CHF * 2 - 10 CHF
Dollar/Franc duplication
Common equals
Common times

Test Code


public void testMultiplication {
  Dollar five = new Dollar(5);
  assertEquals(new Dollar(10), five.times(2));
  assertEquals(new Dollar(15), five.times(3));
}

TDD/BDD in Ruby - Chapter 4

To-Do List

$5 + 10 CHF = $10 if rate is 2:1
$5 * 2 - $10
Make "amount" private
Dollar side effects?
Money rounding?
equals()
hashCode()
Equal null
Equal object

Test Code


public void testMultiplication {
  Dollar five = new Dollar(5);
  assertEquals(new Dollar(10), five.times(2));
  assertEquals(new Dollar(15), five.times(3));
}

TDD/BDD in Ruby - Chapter 3

To-Do List

$5 + 10 CHF = $10 if rate is 2:1
$5 * 2 - $10
Make "amount" private
Dollar side effects?
Money rounding?
equals()
hashCode()


public void testEquality() {
  assertTrue(new Dollar(5).equals(new Dollar(5)));
}

TDD/BDD in Ruby - Chapter 2

TDD Cycle

  1. Write a test
  2. Make it run
  3. Make it right

The goal is clean code that works - Ron Jeffries

So we want to test multiplication and make sure that the "times()" method returns the right amount when passed a multiplier.


public void testMultiplication() {
  Dollar five = new Dollar(5);
  Dollar product = five.times(2);
  assertEquals(10, product.amount);
  product = five.times(3);
  assertEquals(15, product.amount);
}

RSpec - Behaviour Specification Framework for Ruby

RSpec is a behaviour specification framework for Ruby. RSpec was created in
response to Dave Astels’ article _A New Look at Test Driven
Development_ which can be read at: daveastels.com/index.php?p=5
RSpec is intended to provide the features discussed in Dave’s
article.

Nunit V.2 for People Who Can't Cook

In this article you will discover how to use how to use NUnit V.2 efficiently with your .Net projects.

Syndicate content