Dashboard > GreenPepperOpen > ... > Writing executable specifications > Writing an executable specification with the Set up
  GreenPepperOpen Log In View a printable version of the current page.  
  Writing an executable specification with the Set up
Added by Louis Thibault, last edited by Francois Denommee on Mar 24, 2009  (view change)
Labels: 
(None)

Import
com.greenpepper.samples.fixture.bank
Begin Info

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, GreenPepper 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

Second row: the Header

The second row is called the header row and serves to identify the data to be inserted in the system under development.

Example: In our bank example, the header row could take the following form.

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.

End Info

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.

do with bank

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

Begin Info

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, GreenPepper 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, GreenPepper 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, GreenPepper will color this specific cell yellow and will include the information about the exception.

The examples provided in this page are used to explain how to write the fixture for the SetupInterpreter.

End Info

good

Posted by Anonymous at Sep 15, 2008 08:30
DEMONSTRATION LICENSE - This Confluence site is for demonstration purposes only. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.4.3 Build:#705 Mar 21, 2007) - Bug/feature request - Contact Administrators