Dashboard > GreenPepperOpen > ... > Writing executable specifications > Rule For Definition
  GreenPepperOpen Log In View a printable version of the current page.  
  Rule For Definition
Added by Louis Thibault, last edited by Louis Thibault on Jan 23, 2007  (view change)
Labels: 
(None)

 GreenPepperAnonymous access is denied. You must log in to use GreenPepper.
Import
com.greenpepper.samples.application.calculator
Begin Info
DEFINITION

The RuleForInterpreter is used to express concrete and measurable business rules.
During the execution of the specification, GreenPepper compares the values returned by the system under development against the expected values defined by the Business Expert.

  • The first row of the table indicates the set of rules to be tested by GreenPepper.
  • The next row is called the header row and serves to distinguish the given values and the expected values. Given values serve as inputs to the system, whereas expected values serve as comparison values against values that are actually returned by the system. When a column header ends with special characters ? or (), it denotes an expected value.
  • Finally, the remaining rows capture the examples. They are the executable test rows.

Specific Keywords for expected values

GreenPepper offers a list of useful keywords to support the Business Expert.

Empty cells When a test cell is left blank, GreenPepper only shows the returned value
error When you expect an error, specify it in the cell to test that particular behavior
OGNL You can use OGNL expressions as expected test results.
End Info
rule for calculator
x y quotient?
6 2  
1 0 error
30 3 ? >= 9 and ? < 12
30 2 =30/2

Coloring

Begin Info

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

GREEN When the expected value match the returned value, the RuleForInterpreter colors the cell as "right" by coloring it green.
RED If the values don't match, the RuleForInterpreter colors the cell as "wrong" in red.
YELLOW If the system encounters an execution error, the cell is colored yellow and GreenPepper provides information about the error.
GRAY If no expected value is specified in a test, the RuleForInterpreter colors the cell in gray.
End Info

Here is an example of cell coloring:

rule for calculator
x y sum? product() quotient?
10 0 10 0 0
6 3 9 -5  
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