Summary
There are two questions worth asking oneself over and over when creating automated acceptance tests.
- What is the purpose of this test?
- Does the test express this purpose as clearly as possible?
This clinic uses exercises and examples to reinforce the good habit of writing tests with a clear purpose. Our focus is on favoring “declarative-style” tests over “procedural-style” tests. (See Bill Wake’s explanation of the difference at http://xp123.com/xplor/xp0503/index.shtml)
The key learning — writing purposeful tests — is applicable in any testing tool; we have chosen to give the exercises and instruction in FitNesse (Java), so this clinic will also give attendees a way to learn and practice FitNesse skills.
Objectives
- Learn how to write more understandable tests.
- Create stronger, more useful tests with less effort.
- Build test suites that are valuable to non-testers.
- Gain experience writing and running tests in FitNesse (Java).
- Understand the benefits of FIT/FitNesse table-based approach to testing.
Audience
- Developers and testers interested in creating automated acceptance test suites in FitNesse.
- Bring a laptop set up with a Java development environment. (Or perhaps the instructors can provide USB drives for attendees with complete setup for this clinic)
Process/Mechanics
Our teaching style uses small, guided exercises in the first session, moving to more free-form and challenge in the second session.
First session: Introduction to Purposeful Testing in FitNesse
- Readability: Participants quickly look at a set of sample tests and rate each one for understandability. Gather all ratings, show tests in order of rating, discuss what makes tests readable or unreadable.
- Creating test objectives from requirements: Participants create test objectives for a requirement; instructors provide a “bad” example to contrast with good objectives created by participants.
- Writing tests in FitNesse: ColumnFixture and ActionFixture.
- Removing unnecessary detail: Participants refactor a messy, unreadable test into a clearly understandable test.
- Declarative vs. procedural style: Participants refactor a set of procedural tests into a single declarative test.
- Debrief and discuss advantages of FIT’s table-based approach.
- Agile wrap-up: Participants share one insight they have gained.
Second sesssion: Practicing Purposeful Testing in FitNesse
- Clear tests encourage more ideas: Show one sample test at a time (Perhaps have about 5 sample tests?) Participants brainstorm to come up with more test cases for that test. Discuss which tests made it easier for them to think of more test cases.
- Self-guided practice: Teams write tests for a sample application. Instructors answer questions and provide help as needed.
- Teams swap tests. The new “owners” of the tests spend a moment looking over the tests to identify their purpose; then present to the whole group.
- Agile wrap-up: Participants share one insight they have gained.
About the Instructors
Kay has 8 years experience leading automated testing efforts, extensive FitNesse experience and has taught corporate training courses on FitNesse. Christian is the author of the open-source testing framework Jameleon and has mentored teams on unit and acceptance testing for over 7 years. Both instructors presented tutorials at Agile 2007 and have been active in the Agile community since 2001.