Specification Guide

Since GreenPepper 4.2 It is possible to write your specification in Markdown instead of strict HTML. For this, see the Markdown usage page for more information.


Please Note:

The following executable tables are designed with a header row of 2 columns. This is just design. You can create tables with e.g. 3x3 cells.

Writing my first executable specification

Writing an executable specification for a Calculator program

Consider your customer wants to create a calculator.

The business expert on Calculators explains to the developer the rules for calculation. The first specification is: The calculator should be able to add two numbers. To support the specification, the business expert also provides an example: 6 + 3 = 9.

In order to be executable in GreenPepper, the specification must be expressed in a specific form :

rule forCalculator
xysum?
639

The first line of the specification explains that we have particular RULES FOR our Calculator. The calculator receives two numbers and gives back the sum of those two numbers. Once the calculator is developed, we will be able to execute the specification to test the functionality.

Execute the specification

If you hit the Execute button on the top of the page, you will get the result of your test.

How it works?

Once you click on the Execution button, GreenPepper calls the actual software containing the code for the Calculator. It sends the parameters x (equal to 6) and y (equal to 3) to the Calculator to obtain the resulting sum of those two numbers. The "?" symbol next to the word "sum" is a key-sign, that indicates to GreenPepper that a test must be performed.

In that particular example, GreenPepper will query the calculator application and compare the value returned by the system with the value specified by the business expert (in the "sum?" column). Since the result returned by the system is the same as the expected result, the cell is colored in green by GreenPepper. The business expert is now confident that the Calculator is able to add two numbers.

Adding another example

Once the Calculator is developed, the business expert may think about new examples that he would like to test. The business expert adds another row in the Rule For table and executes the test (no coding is needed here).

rule forCalculator
xysum?
639
708

When there is an error, GreenPepper colors the cell in red.
In the new example, it is clear that the expected value provided by the business expert is not correct. But the error could have been in the system.

The business expert should always be consulted before any changes are made in the executable specifications

Adding new specifications to our Calculator

The business expert wants to improve the Calculator: The Calculator should be able to perform product and quotient of two numbers.
The new rules can be written in a way similar to the "sum" specification. In case of expected errors, the keyword error may be used in order to test those special cases.

rule forCalculator
xysum?product?quotient?
628123
7070error

More information in the Specification documentation