Exploration Through ExampleExample-driven development, Agile testing, context-driven testing, Agile programming, Ruby, and other things of interest to Brian Marick
|
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:
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
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:
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
|
|