I'll be presenting a beginner's session at the Agile 2007 conference this year. The session, titled "Learning Test-Driven Development," is intended to provide a brief hands-on introduction to TDD. More details are available at the conference site.
Here are the slides I plan on presenting; they are subject to change:
Slides
As the conference site indicates, the session is intended to be hands-on, but you can also just come to watch and learn. In either case, I'd like to make your experience as smooth as possible. It's a short program, so programming along will require solid developer skills and decent speed.
If you choose to follow along, you can go one of two routes: You can choose to code along as I type and talk, or you can download the test source. Just about everything in the test source is commented out, so you can follow along by uncommenting out lines in the test. (You'll still get to write the production code that we'll be test-driving!)
I'll be using Eclipse 3.3 for my demo, but you should be able to follow along in just about any environment. The demo will be done using Java 6 and JUnit 4.
Note: my session and demo emphasizes learning the techniques involved in doing test-driven development. While you will see most of what you'll need to know on JUnit, learning JUnit is secondary, and I will not be covering all its features. You can find a good reference on JUnit by doing a Google search.
You will need Java version 5.x or 6.x, and JUnit version 4.x.
The below instructions are based on Eclipse 3.3. These instructions should be close to what you will need for earlier versions of Eclipse. Note that there are many ways to accomplish the same tasks using Eclipse!
If the Eclipse instructions do not work for you, or if you are using a different IDE, you should be able to copy the source files directly into your project (or folder, if you're running Java natively). The Manual Instructions below summarizes the steps you need to accomplish.
java.lang.AssertionError: to demonstrate JUnit failure at PortfolioTest.verifyJUnit(PortfolioTest.java:29)
java -classpath .;c:\ProgramData\junit4.4\junit-4.4.jar org.junit.runner.JUnitCore PortfolioTest