These tests are about the StepFixture
fit.StepFixture |
A StepFixture alone is not useful. Instead, it's subclassed. We'll use StepFixtureTestFixture.
fit.StepFixtureTestFixture |
Steps are designated by the first cell of a column. Arguments are in following cells. check is a special name: it calls the no-argument method in the second column and compares the result to the value in the third column.
fit.StepFixtureTestFixture |
|
|
check |
stringIsEmpty |
true |
add |
one string arg |
|
check |
stringIsEmpty |
false |
check |
currentString |
1:/one string arg/ |
add |
arg 1 |
arg 2 |
check |
currentString |
1:/one string arg/2:/arg 1/+/arg 2/ |
add |
|
|
check |
currentString |
1:/one string arg/2:/arg 1/+/arg 2/3:// |
State is maintained across tables, but you can reset it.
fit.StepFixtureTestFixture |
|
|
check |
currentString |
1:/one string arg/2:/arg 1/+/arg 2/3:// |
restart |
|
|
check |
stringIsEmpty |
true |
Because StudlyCaps style is not fit for humans, check arguments and other steps can be written in a more friendly style.
fit.StepFixtureTestFixture |
|
|
check |
string is empty |
true |
add a string |
a string |
|
check |
current string |
1:/a string/ |
Arguments can be any type that FIT knows how to convert.
fit.StepFixtureTestFixture |
|
|
set a date |
January 19, 1960 |
|
check |
date |
January 19, 1960 |
set an integer |
45 |
|
check |
integer |
45 |
You shouldn't use two methods with the same name and same number of arguments. The results are undefined, but doubtless not good.
A check step can also take extra arguments. The last cell remains the expected value, but cells before it are passed to the method.
fit.StepFixtureTestFixture |
|
|
|
|
set a date |
February 9, 1906 |
|
|
|
check |
date |
day |
9 |
|
check |
plus |
1 |
20 |
21 |