Exploration Through Example

Example-driven development, Agile testing, context-driven testing, Agile programming, Ruby, and other things of interest to Brian Marick
191.8 167.2 186.2 183.6 184.0 183.2 184.6

Thu, 08 Apr 2004

FIT: highlighting checks

Part of a series on FIT extensions and stylistic tricks.

Here are two tests with identical contents (exact same words). Which do you prefer?

Orders are given to caretakers and students. Some orders depend on whether the animal's in intensive care or not.

AnimalProgressFixture (a StepFixture)
new case
Betsy
Rankin


Rankin brings in a cow (a comment)
diagnosis
severe mastitis




order
intensive care




order
soap


subjective objective assessment and plan
check
student does
soap
daily


check
student monitors temperature
6 hours

because in intensive care
check
caretaker does
milking
never

no one milks - milking has to be ordered.
check
student does
milking
never


order
milking




check
caretaker does
milking
12 hours


check
student does milking
3 hours

between student and caretaker, cow gets milked every three hours
...




now finish treatment

Orders are given to caretakers and students. Some orders depend on whether the animal's in intensive care or not.

AnimalProgressFixture
new case
Betsy
Rankin


Rankin brings in a cow
diagnosis
severe mastitis




order
intensive care




order
soap


subjective objective assessment and plan
check
student does
soap
daily


check
student monitors temperature
6 hours

because in intensive care
check
caretaker does
milking
never

no one milks - milking has to be ordered.
check
student does
milking
never


order
milking




check
caretaker does
milking
12 hours


check
student does milking
3 hours

between student and caretaker, cow gets milked every three hours
...




now finish treatment

I prefer the second. If I want a quick idea of what the test's about, it's easy to scan the rows and just read the bold ones. It's comparatively hard to figure out what's going on if the steps in the test don't stand out from the checks. Other people might use color to distinguish the two types of rows. I find font changes less distracting than color changes. (As you can tell from this page or my main page, I'm a pretty colorless person.)

A test is two things: an example of use and a check of correct results. I've always been bothered when I can't see the examples for the checks, and I've gone to silly lengths at times to keep them separate. Here's a test written in Ruby:

  def test_a_normal_day
    start_background_job
                                assert_states([@misc], [])
    start 'stqe'
                                assert_states([@stqe], [@misc])
    start 'timeclock'
                                assert_states([@timeclock], [@misc, @stqe])


    pause_without_resumption
                                assert_states([], [@timeclock, @misc, @stqe])

I don't go this far as a rule, but I wanted to talk about these tests with my Customer. This format let us step through the commands one by one. For each, I'd translate the assertion into human language. She didn't have to pay attention to anything on the right.

## Posted at 13:44 in category /fit [permalink] [top]

About Brian Marick
I consult mainly on Agile software development, with a special focus on how testing fits in.

Contact me here: marick@exampler.com.

 

Syndication

 

Agile Testing Directions
Introduction
Tests and examples
Technology-facing programmer support
Business-facing team support
Business-facing product critiques
Technology-facing product critiques
Testers on agile projects
Postscript

Permalink to this list

 

Working your way out of the automated GUI testing tarpit
  1. Three ways of writing the same test
  2. A test should deduce its setup path
  3. Convert the suite one failure at a time
  4. You should be able to get to any page in one step
  5. Extract fast tests about single pages
  6. Link checking without clicking on links
  7. Workflow tests remain GUI tests
Permalink to this list

 

Design-Driven Test-Driven Design
Creating a test
Making it (barely) run
Views and presenters appear
Hooking up the real GUI

 

Popular Articles
A roadmap for testing on an agile project: When consulting on testing in Agile projects, I like to call this plan "what I'm biased toward."

Tacit knowledge: Experts often have no theory of their work. They simply perform skillfully.

Process and personality: Every article on methodology implicitly begins "Let's talk about me."

 

Related Weblogs

Wayne Allen
James Bach
Laurent Bossavit
William Caputo
Mike Clark
Rachel Davies
Esther Derby
Michael Feathers
Developer Testing
Chad Fowler
Martin Fowler
Alan Francis
Elisabeth Hendrickson
Grig Gheorghiu
Andy Hunt
Ben Hyde
Ron Jeffries
Jonathan Kohl
Dave Liebreich
Jeff Patton
Bret Pettichord
Hiring Johanna Rothman
Managing Johanna Rothman
Kevin Rutherford
Christian Sepulveda
James Shore
Jeff Sutherland
Pragmatic Dave Thomas
Glenn Vanderburg
Greg Vaughn
Eugene Wallingford
Jim Weirich

 

Where to Find Me


Software Practice Advancement

 

Archives
All of 2006
All of 2005
All of 2004
All of 2003

 

Join!

Agile Alliance Logo