Dashboard > GreenPepper Examples > Home > Table of rules sample
  GreenPepper Examples Log In View a printable version of the current page.  
  Table of rules sample
Added by gcarey, last edited by Francois Denommee on Mar 25, 2008  (view change)
Labels: 
(None)

 GreenPepperAnonymous access is denied. You must log in to use GreenPepper.

Testing a Table of Rules on a System

In this example we're planning to write a calculator executable specification. You can find some basic rules in the first executable specifications page. We will use the Rule For formalism to define the business rules of the basic calculator.

We need to specify the package in which our calculator fixture is coded. Once the execution is started, GreenPepper searches the fixtures name in the package specified in the import tables.

import
com.greenpepper.samples.application.calculator

In a Rule For formalism, the first row specifies the name of the interpreter and the name of the fixture.
The second row specifies the input parameter names and tests we want to execute.
The remaining rows indicate values for each input parameter and the expected result from the specified tests. In the last row, you can see how expected validation errors are specified.

You are now ready to execute the tests.

In last row, we specify that the product of 7 and 0 should be 5 (column product?). The cell is now colored in red and we see that there is an error since the product of 7 and 0 is 0, not 5. All the other cells are colored in green since the expected values match the returned values.

rule for calculator
x y sum? product? quotient?
6 2 8 12 3
7 0 7 0 error

You can also read a description on Writing fixtures for Rule Tables

Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.4.3 Build:#705 Mar 21, 2007) - Bug/feature request - Contact Administrators