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

Wed, 05 Oct 2005

Tweak to CalculateFixture

I've become fond of FitLibrary's CalculateFixture. The second table below is an example:

create clinic with 7 stalls
which are sand stalls? 4, 6
which are bull stalls? 1

...

When there's no room for an animal in a normal stall, put it in a sand stall, or in a bull stall as last resort.

how stalls are assigned
special stall? stalls in use stall assigned
no 2, 3, 5, 7 4
no 2, 3, 4, 5, 6, 7 1

The columns to the left of the blank column are input values. Those to the right are expected results. The blank column is a nice visual separator.

Each line of a table should be easy to understand. Sometimes that means annotation. I've hacked my copy of CalculateFixture to allow notes after yet another blank column. Like this:

create clinic with 7 stalls
which are sand stalls? 4, 6
which are bull stalls? 1

...

When there's no room for an animal in a normal stall, put it in a sand stall, or in a bull stall as last resort.

how stalls are assigned
special stall? stalls in use stall assigned notes
no 2, 3, 5, 7 4 Only sand stalls are free, so use one.
no 2, 3, 4, 5, 6, 7 1 No place to go but bull stall

That's easily done in the 9Feb2005 version. In bind:

for (int i = 0; heads != null; i++, heads = heads.more) {
    String name = heads.text();
    try {
	if (name.equals("")) {
+           if (pastDoubleColumn) break;
//          if (argCount > -1)
//              throw new FitFailureException("Two empty columns");
            argCount = i;
            targets = new MethodTarget[rowLength-i-1];
      

And remove an error check in doRow:

if (row.parts.size() != argCount+methods+1) {
    exception(row.parts,"Row should be "+(argCount+methods+1)+" cells wide");
    return;
}
      

I'd like to see this change become part of FitLibrary. It cannot break existing tables (because of the error check). The error check would no longer catch mistakes in the table, but I can't see such a mistake lasting past the first time someone tried to make the test pass. It would be easy enough to change the error check to take blank columns into account, but I doubt I'd bother.

## Posted at 15:31 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