{"id":8577,"library":"radish-bdd","title":"radish-bdd","description":"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.","status":"active","version":"0.18.4","language":"en","source_language":"en","source_url":"https://github.com/radish-bdd/radish","tags":["bdd","testing","gherkin","automation","python"],"install":[{"cmd":"pip install radish-bdd","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"radish-bdd requires Python 3. Older versions supported Python 2, but this is no longer the case.","package":"Python","optional":false}],"imports":[{"note":"These decorators are used to define step implementations in your Python files.","symbol":"given, when, then","correct":"from radish import given, when, then"},{"note":"These decorators are used to define hooks that run before or after features, scenarios, or steps.","symbol":"before, after","correct":"from radish import before, after"},{"note":"The 'world' object provides global context for configuration and utility functions. For scenario-specific data, use `scenario.context` instead of `world` to avoid state leakage.","symbol":"world","correct":"from radish import world"},{"note":"Used for programmatic execution of radish tests, typically for integration with other tools.","symbol":"main","correct":"from radish import main"}],"quickstart":{"code":"# 1. Create a feature file (e.g., calculator.feature):\n# Feature: Simple Calculator\n#   In order to avoid silly mistakes\n#   As a math enthusiast\n#   I want to be able to add numbers\n#\n#   Scenario: Add two numbers\n#     Given I have the number 5\n#     And I have the number 7\n#     When I add them\n#     Then the result should be 12\n\n# 2. Create a step implementation file (e.g., radish/steps.py):\nfrom radish import given, when, then, world\n\n@given(\"I have the number {number:g}\")\ndef have_number(step, number):\n    if not hasattr(world, 'numbers'):\n        world.numbers = []\n    world.numbers.append(number)\n\n@when(\"I add them\")\ndef add_numbers(step):\n    world.result = sum(world.numbers)\n\n@then(\"the result should be {expected_result:g}\")\ndef check_result(step, expected_result):\n    assert world.result == expected_result\n\n# 3. Run from your terminal in the directory containing 'calculator.feature':\n# radish calculator.feature","lang":"python","description":"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."},"warnings":[{"fix":"Ensure your project is running on Python 3.x. Update your environment and code if necessary.","message":"radish-bdd officially dropped support for Python 2 in recent versions (specifically 0.18.0+). Projects migrating from very old radish versions must upgrade to Python 3.","severity":"breaking","affected_versions":"<0.18.0"},{"fix":"For data specific to a scenario, use `scenario.context`. Example: `scenario.context.my_data = 'value'` instead of `world.my_data = 'value'`.","message":"The `world` object provides a global context, but it is not intended for storing scenario-specific data. Using `world` for this purpose can lead to test interference and state leakage between scenarios.","severity":"gotcha","affected_versions":"All"},{"fix":"Ensure all steps in your feature files have a matching Python function decorated with `@given`, `@when`, or `@then`. Use the `--dry-run` (`-d`) option to identify unimplemented steps without actually executing them.","message":"If a Gherkin step in your feature file does not have a corresponding Python step implementation, radish will raise an exception and stop the test run.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"On Debian/Ubuntu: `sudo apt-get install libxml2-dev libxslt1-dev zlib1g-dev`. On other Linux distributions, use the equivalent package manager. For Windows, ensure all C++ build tools are installed or try updating `pip` and `lxml` itself: `pip install --upgrade pip lxml`.","cause":"This error or similar `lxml` related errors (e.g., `cannot find -lz`) often indicate missing C libraries like libxml2, libxslt1-dev, or zlib1g-dev required by `lxml`, which radish-bdd uses for XML reporting. This was a known issue, especially on Linux and older Windows installations.","error":"lxml.etree.XMLSyntaxError: Document is empty, line 1, column 1"},{"fix":"Implement the missing step function in your `radish/steps.py` (or other step definition files). For example, for 'Given I have an unimplemented step', add `@given(\"I have an unimplemented step\")\\ndef have_unimplemented_step(step):\\n    pass`.","cause":"A step defined in your `.feature` file does not have a matching Python function decorated with `@given`, `@when`, or `@then` in your step definition files.","error":"radish.exceptions.RadishError: No step implementation found for step 'Given I have an unimplemented step'"}]}