Get, read and understand Kent Beck: "Test driven development by example". The rest will follow naturally.