Fork me on GitHub
radish is not just another BDD tool ...
The Root From
Red To Green
Getting started Documentation

Overview

radish is a Behavior Driven Development tool complitely written in python.

Gherkin compatible

radish is fully compatible with cucumber's Gherkin language.

Additional feature syntax

In addition to the fully supported Gherkin language radish supports some more functionality like: Scenario Preconditions, Scenario Loops, Variables and Expressions.

Pythonic

radish tries to provide the most awesome pythonic experiences when implementing your steps and hooks. Your test code should be as great as your project's code.

Getting started

Write your first tests with radish in less then 5 minutes.

  • Step 1

    Download radish

    radish is available in PyPi. Use pip to install radish:
    pip install radish-bdd

  • Step 2

    Create your first feature file

    All your tests are written in the BDD gherkin language and saved as .feature files. Let's name ours calculator.feature. A feature file is as simple as the following:

    Feature: My first feature file using radish
        In order to test my awesome software
        I need an awesome BDD tool like radish
        to test my software.
    
        Scenario: Test my calculator
            Given I have the numbers 5 and 6
            When I sum them
            Then I expect the result to be 11

  • Step 3

    Write our steps

    Every line inside a Scenario is called a step. You have to provide a python function for every step in order to execute some code. Let's write our first step.py file:

    # -*- coding: utf-8 -*-
    
    from radish import given, when, then
    
    @given("I have the numbers {number1:g} and {number2:g}")
    def have_numbers(step, number1, number2):
        step.context.number1 = number1
        step.context.number2 = number2
    
    @when("I sum them")
    def sum_numbers(step):
        step.context.result = step.context.number1 + \
            step.context.number2
    
    @then("I expect the result to be {result:g}")
    def expect_result(step, result):
        assert step.context.result == result

  • Step 4

    Run your tests

    Nothing more is needed - Let's run our tests:
    radish calculator.feature

  • Let's
    write more
    features!