Writing a Setup specification
When do we use the SetUpInterpreter
The SetUpInterpreter is used to simplify the creation of a particular state for the system under development. Once the state is created, we can focus on the business process to test.
When a setup table is executed,
enter data in the system under development to create the desired state.
First row: Identification of the Set Up
As for all other interpreters, the first row of the setup table specifies the name of the interpreter and the name of the desired state.
Example of a bank Account management system
Example context : A customer should be allowed to transfer money from his or her accounts.
In order to create examples that would test this particular business rule, we need to create a set of customer. The first line of our setup table could be expressed as
| setup |
a group of customers |
The second row is called the header row and serves to identify the data to be inserted in the system under development.
| setup |
a group of customers |
| type |
number |
first name |
last name |
balance |
Following rows: Data
The remaining rows captures the data to be inserted. They are the executable rows.
Final expression of our example
| setup |
a group of customers |
| type |
number |
first name |
last name |
balance |
| checking |
11111-11111 |
Fred |
Flintstone |
$250.00 |
| savings |
22222-22222 |
Fred |
Flintstone |
$10 000.00 |
| savings |
44444-44444 |
Wilma |
Flintstone |
$10 000.00 |
| checking |
44444-44444 |
Barney |
Rubble |
$999.54 |
| checking |
55555-55555 |
Great |
Gazoo |
abc |
From that point, we can now used those accounts to specify examples that define a business rule.
Transfer from a savings account to a checking account of the same customer
| accept |
Transfer |
$1 000.00 |
from account |
22222-22222 |
to account |
11111-11111 |
| check |
that balance of account |
11111-11111 |
is |
$1 250.00 |
| check |
that balance of account |
22222-22222 |
is |
$9 000.00 |
Execution of specification
Based on those executable specifications, the developers are now ready to code the functionality and the fixture (the fixture is the link between the system under development and the executable specification). Once this is done, the specification can be executed by clicking on the Execute button on the top of the page.
During execution,
confirm that the value has been entered by adding a green cell at the end of each data rows containing the word entered.
If the data could not have been entered because it does not respect a known business rule, the cell will be yellow and will specify the stacktrace. Finally, if the data could not have been entered because of an unknown error,
will add a yellow cell at the end of the row containing information about the exception. Note that if the error is specific to a data provided,
will color this specific cell yellow and will include the information about the exception.