As mentioned in earlier, for our automated acceptance tests,
we use the open source software Fitnesse. Part 1 had a quick overview of how
to use Fitnesse, but for more extensive information on how to use Fitnesse, I
recommend going to the Fitnesse website.
As mentioned previously, Fitnesse organizes tests into a
spreadsheet like manner. In fact you can create tests in Excel, and then
export them into Fitnesse. For our test we are going to keep it simple. We
are going to check that a formula field contains the correct date. Below is a
sample of the Fitnesse test:
Fitnesse Test 1
Values In Report
|
|
|
field name
|
value
|
ok()
|
Changeset
|
today
|
TRUE
|
This simple test first checks the field name, and then the
value. Notice in the value column there is the word today. For this test, the
test writer and the developer have agreed that today means something. What
they agreed on is that it means today's date in the format mm/dd/yyyy. Also,
there do not have to be leading digits. So if today is November 1st, 2008, the
test writer would expect 11/1/2008.
The last column, ok expects that a
true will be returned. Now let's look at the code we used to write this test.