Skip to content
Novus Examples
feature1.4 KB

Gherkin — Checkout Feature (Background, Outline, Doc String)

The source feature for this whole group: a Background with a data table, a plain scenario, a Scenario Outline expanded by two Examples tables, and a scenario asserting against a doc string. It compiles to exactly six pickles and 32 pickle steps — the numbers the cucumber-messages and cucumber.json twins next to it report.

Preview — first 50 linesfeature
# language: en
@checkout @smoke
Feature: Checkout totals
  As a shopper
  I want the cart total to include tax and discounts
  So that I am never surprised at the payment step

  Background:
    Given the catalogue contains:
      | sku     | name             | price |
      | NX-1042 | Sample desk lamp | 12.99 |
      | NX-2087 | Sample notebook  |  4.50 |
    And the tax rate is 20 percent

  @pricing
  Scenario: A single-item cart shows tax separately
    Given my cart is empty
    When I add 1 of "NX-1042"
    Then the subtotal is "12.99"
    And the tax is "2.60"
    And the total is "15.59"

  @pricing @outline
  Scenario Outline: Quantity multiplies the subtotal
    Given my cart is empty
    When I add <quantity> of "<sku>"
    Then the subtotal is "<subtotal>"

    Examples: whole units
      | sku     | quantity | subtotal |
      | NX-1042 |        1 |    12.99 |
      | NX-1042 |        3 |    38.97 |
      | NX-2087 |        2 |     9.00 |

    @edge
    Examples: boundary quantities
      | sku     | quantity | subtotal |
      | NX-1042 |        0 |     0.00 |

  @receipt
  Scenario: The receipt renders as plain text
    Given my cart contains 1 of "NX-1042"
    When I request the receipt
    Then the receipt reads:
      """
      Novus Checkout SAMPLE receipt
      1 x Sample desk lamp        12.99
      Tax (20 percent)             2.60
      Total                       15.59
      """
51 lines total — download for the full file.

Specifications

Seed
61200
Encoding
UTF-8
Line Endings
LF
Gherkin Dialect
en
Scenarios
2
Scenario Outlines
1
Examples Tables
2
Example Rows
4
Pickles
6
Background Steps
2
Data Tables
1
Doc Strings
1
Feature Tags
2
Total Pickle Steps
32

Testing contract

Expected to pass
Scenario
Compile a Gherkin feature into pickles and count the steps a runner will execute.
Expected result
6 pickles and 32 pickle steps are produced, matching the pickle envelopes in the cucumber-messages twin exactly.

What is a .feature file?

A .feature file holds a Gherkin specification: a business-readable, plain-text description of behaviour written as Feature, Background, Scenario, and Scenario Outline blocks whose steps begin with Given, When, Then, And, or But. Scenario Outlines are parameterised by an Examples table, and tags such as @smoke mark subsets of the suite. Cucumber, Behave, SpecFlow, and Behat all read the same grammar, with localised keyword sets available for non-English specifications.

How to use this file

Use an example .feature file to test Gherkin parsers, step-definition matchers, linters, and editor tooling — verifying tag inheritance, Scenario Outline expansion against the Examples table, docstring and data-table arguments, and behaviour on deliberately malformed keywords.

How to use this file for testing

“Gherkin — Checkout Feature (Background, Outline, Doc String)” is a deterministic Novus Examples fixture for Code parsing, Conversion testing, Editor testing. Short, known-correct source files in many languages with classes, functions, generics, enums, and error handling — for testing parsers, linters, formatters, language detection, and diff viewers.

Documented properties for this file: seed 61200 · UTF-8 · LF. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Test and coverage reports document their totals (suites, cases, passes, failures, skips, covered lines) in the spec table. Point your CI dashboard, coverage gate, or report converter at the file and assert those counts survive; format twins carry identical numbers so a conversion can be scored exactly.

Generated by generation/testing.py. Free for any use, no attribution required — license.