radish-bdd

0.18.4 · active · verified Thu Apr 16

radish is a Behavior Driven Development tool completely written in Python. It supports all Gherkin language features and also implements unconventional BDD features such as Scenario Preconditions, Scenario Loops, Constants, and Expressions. The library is actively maintained, with the latest stable version 0.18.4 released on February 24, 2026.

Common errors

Warnings

Install

Imports

Quickstart

To get started with radish, you typically create a `.feature` file written in Gherkin syntax and a corresponding Python file (e.g., `radish/steps.py`) with step implementations. Then, you execute `radish` from your terminal, pointing to the feature file.

# 1. Create a feature file (e.g., calculator.feature):
# Feature: Simple Calculator
#   In order to avoid silly mistakes
#   As a math enthusiast
#   I want to be able to add numbers
#
#   Scenario: Add two numbers
#     Given I have the number 5
#     And I have the number 7
#     When I add them
#     Then the result should be 12

# 2. Create a step implementation file (e.g., radish/steps.py):
from radish import given, when, then, world

@given("I have the number {number:g}")
def have_number(step, number):
    if not hasattr(world, 'numbers'):
        world.numbers = []
    world.numbers.append(number)

@when("I add them")
def add_numbers(step):
    world.result = sum(world.numbers)

@then("the result should be {expected_result:g}")
def check_result(step, expected_result):
    assert world.result == expected_result

# 3. Run from your terminal in the directory containing 'calculator.feature':
# radish calculator.feature

view raw JSON →