Specification by example

Specifying a business rule with concrete examples: key examples, example tables, boundary values, an example that reveals a missing rule and Gherkin scenarios the client can read.

  • 24 cards
  • 3 topics
  • Free

The outline, topic by topic

Each topic is weighted the way the exam weighs it.

  1. Concepts
  2. Questions
  3. The numbers

A few cards from the deck

  • Business rule: what is it?

    Show the answer

    A general statement of how the organisation decides or calculates, independent of any screen: “free delivery from €50”.

    A general sentence lets ambiguities through (does “from €50” include €50?). Worked examples are there to remove them.

  • The rule says “free delivery from €50”. Which example reveals whether the threshold is included?

    • A basket of €50.00
    • A basket of €49.99
    • A basket of €50.01
    • A basket of €100.00
    Show the answer

    A basket of €50.00

    Only the exact value of the threshold says whether the rule means “greater than or equal to” or “strictly greater than”. At €49.99 the fee is due in both readings; at €50.01 and €100 delivery is free in both.

  • In a Gherkin scenario outline, the variable values are written in …, like <amount>, and filled from a table introduced by ….

    Show the answer

    In a Gherkin scenario outline, the variable values are written in angle brackets, like <amount>, and filled from a table introduced by Examples.

    Each row of the table runs the scenario once, replacing each parameter with the value in its column.

  • Key example: what is it?

    Show the answer

    A concrete, numerical case, shared with the client, that illustrates a rule and is kept because it covers something the others do not.

    Two examples of the same kind (€60 and €70 for “free from €50”) say nothing more than one of them: only one is kept.

  • The rule says “free from €50”. The client gives the example “€60 to Corsica: €8 delivery fee”. What does the example reveal?

    • A typing error to remove from the table
    • An exception the written rule leaves out
    • A case too rare to be specified
    • A flaw in the team's scenario outline
    Show the answer

    An exception the written rule leaves out

    When an example contradicts the written rule, the rule is often incomplete: here a geographic exception nobody had stated. The example has done its job.