Versions Compared

Key

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

...

Example of fixture name with implicit import
import
com.xyz.mystuff
list ofFixtureName
....

GreenPepper will match com.xyz.stuffmystuff.FixtureName.

You can have more than one package or namespace imported in a document. Just add more lines to the import table.

...

Definition

The RuleForInterpreter is used to express concrete and measurable business rules.
During the execution of the specification, GreenPepper Image Added 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 Image Added.
  • 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.

...

As we've seen in the Rule For definitionDefinition, a table of rules is used to express business rules of the application under development.

...

This page shows the fixture code that supports the examples introduced in the Writing a Rule For specificationSpecification  documentation.

Fixture for Calculator

...

Code Block
languagejava
titleCode for the system under development
public class InsuranceFee
{
    private final Money salePrice;

    public InsuranceFee(Money salePrice)
    {
        this.salePrice = salePrice;
    }

    public Money forDownpaymentforDownPayment(Money downPayment)
    {
        return downPayment.greaterThan(salePrice.times(Ratio.percent(25))) ? Money.zero() : financedAmount( downPayment ).times( Ratio.of(25, 1000) );
    }

    private Money financedAmount(Money downPayment)
    {
        return salePrice.minus( downPayment );
    }
}

...