Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

Table of Contents
maxLevel3
absoluteUrltrue

 

...

Definition

Definition

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.

  • The first row of the table indicates the name of the interpreter and the name of the desired state.
  • The second row is called the header row and serves to identify the data to be inserted in the system under development.
  • Finally, the remaining rows captures the data to be inserted.

...

Coloring

 will visually show the test result by coloring each testing cell:

...

Panel
bgColor#f0e68c
titleBGColor#f0e68c
titleYELLOW
borderStyledashed

If the insertion has failed because a specified value generates an error,  colors the cell of the data in error yellow and provides information about the error.
If the system encounters an error not related to a specific data,  add a yellow cell at the end of the data row and provides information about the error.

...

Writing fixtures for Setup tables

As we've seen in Setup Definition, a table of rules 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.

This page shows the fixture code that supports the examples introduced in the Writing a Setup specification.

...

Fixture to create bank customers

Consider the example of setup table described in Writing a Setup specification:

...

The fixture code to support this example in Java is the class AGroupOfCustomersFixture shown below.

...

Show me the code

 

Code Block
languagejava
titleCode for the creation of a group of customers fixture
public class AGroupOfCustomersFixture 
{
	public AccountType type;
	public String number, firstName, lastName;
	public Money balance;
	public static Bank bank;
	
	public AGroupOfCustomersFixture()
	{
		bank=new Bank();
	}
	
	@EnterRow
	public void setupAccount()
	{
		if(AccountType.SAVINGS == type)
			bank.openSavingsAccount(number, new Owner(firstName, lastName)).deposit(balance);
		
		else if(AccountType.CHECKING == type)
			bank.openCheckingAccount(number, new Owner(firstName, lastName)).deposit(balance);
	}
}

...

How is the table processed?

When it runs this table,  reads the first row to select the interpreter and fixture. It then reads the second row to know what the attribute columns are. Finally, it starts creating entries from the third row down to the end of the table.

For the third row  carries out the following sequence of steps:
It assigns the data 11111-11111               to number, checking to type, Fred to first name, Flintstone to last name and $250.00 to balance.
It then calls the method enterRow() of the fixture AGroupOfCustomersFixture to open a bank account with the given data.

 

 

Previous PageFirst PageNext Page