Behat vs pytest-bdd
Behat
behat.orgpytest-bdd
pytest-bdd.readthedocs.ioSide by side
| Figure | Behat | pytest-bdd |
|---|---|---|
| Price from | Free | Free |
| Free plan | Yes | Yes |
| Free trial | — | — |
| Open source | — | — |
| Windows | — | Yes |
| macOS | — | Yes |
| Linux | Yes | Yes |
| Plans published | 1 | 1 |
| Spec score · BDD Testing Tools | 7.7 (#10) | 7.4 (#19) |
| Installation | The documented installation methods are Composer and a PHAR executable, both run using PHP. | The documentation gives `pip install pytest-bdd` as the installation command. |
| Purpose | Behat is an open source behavior-driven development tool for writing executable software specifications in plain language. | pytest-bdd implements a subset of Gherkin to automate requirements testing and support behavior-driven development. |
Plans
In their own words
Behat
Behat is free, open-source software for writing executable specifications in plain language on Linux. It is the PHP implementation of Cucumber and runs Gherkin feature files. Those files can describe complete application behavior and be exercised through browser automation, HTTP API calls, shell commands, databases, filesystems, or PHP code. Behat is intended to work with any PHP framework or without one. Installation uses Composer or a PHAR executable, both running with PHP. An extension system can expand or replace nearly any part of the tool, with extensions covering framework integrations, browser automation, test reporting, and data fixtures. Behat does not provide its own assertion tool, so an external assertion library is needed. It supports current PHP and third-party dependency versions; Symfony 8 support begins with Behat 4.0. Each major version receives security fixes for 24 months after the next major release.
pytest-bdd
pytest-bdd is a Python package for automating requirements tests with behavior-driven development. It implements a subset of Gherkin and runs scenarios as pytest tests, without a separate test runner. Feature steps can reuse pytest fixtures through dependency injection, and step definitions can accept arguments parsed as strings, with parse or cfparse formats, or by regular expression. The scenarios helper can bind scenarios from feature files and folders, including recursive folder discovery. Scenario outlines support parameterized cases and tagged example tables; step functions can also receive Gherkin data tables as row lists and docstrings as strings. For browser tests, the documented example uses pytest-splinter to provide a browser fixture. Installation is via `pip install pytest-bdd`. The package is open source under the MIT License, free at free, and requires Python 3.10 or newer. Listed platforms are Linux, macOS, and Windows.