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

Fri, 09 Apr 2004

"Bang!" went the ColumnFixture

Part of a series on FIT extensions and stylistic tricks.

ColumnFixtures are useful when you want to vary data a lot but vary processing not at all. Having each row be a separate test is very tidy.

Sometimes the sequence of events is this:

  1. provide data (which varies)
  2. do something that changes state (always the same thing)
  3. check that the state was changed correctly (always the same way)
Notice that, even though there are three steps, the ColumnFixture has only two types of columns: input values, and methods whose results should be checked. Those correspond nicely to the first and third steps, but there's nothing that exactly matches the second.

Now, it's not hard to use the second type of column for that: just have the state-changing method return some random value, like true, and have FIT "check" for it. Here's an example:


number 1
number 2

Still, it bugs me that there's no visual cue that calculate isn't something different from sum. So, taking a leaf from Scheme, I propose that columns used for side-effect be distinguished by ending their name with "!". This eliminates the need for anything to be in the column cells, which visually separates the input from the expected results:


number 1
number 2



I have written a version of ColumnFixture that makes the above test pass. (Here's a zip file that includes it, the test, and the test source. If people want me to, I can include it in my StepFixture jar file.)

This version of ColumnFixture does one other thing. I like space-separated names at the heads of columns, so I added code to "camel case" them. (That is, in the test, "number 1" names method number1. And "do calculation" would name method doCalculation.) To my mind, this makes ColumnFixture consistent with ActionFixture.

## Posted at 16:58 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.




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

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


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



Agile Alliance Logo