Love it or loath it, Python is the language of choice for most Data Scientists – so if the work is done in Python and you are writing the requirements in Gherkin, what tool should you use to automate testing?
There is no official version of Cucumber for Python, so the options are Pytest-BDD, Behave, and Lettuce. Let’s eliminate Lettuce right up front; here is Github’s graph of commits for the project:

Lettuce is unfortunately a dead project; if you find a bug there is no community that will fix it for you. The last release was in 2016, so unless someone revives it, this isn’t a viable choice.
Pytest-BDD and Behave are both active, so both are worth considering. What are the differences?
Pytest-BDD
Advantages
Pytest-BDD has the advantage of being integrated with Pytest; your developers should find that part of it easy to work with. It can use Pytest fixtures, mocks, etc.
There is no support for data tables – this is a HUGE problem. Data tables are used in many, many scenarios, like this one for a library catalog search:
Author | Title |
---|---|
Stephen King | The Shining |
James Baldwin | If Beale Street Could Talk |
Author | Title |
---|---|
Stephen King | The Shining |
The ‘Given’ in this scenario uses a data table to specify the contents of the catalog, and the ‘Then’ uses a data table to show which titles will be returned by the search. How could you possibly write this scenario without data tables?
Given the books from Fixture1 in the catalog
When a name search is performed for Stephen
Then only the books from Fixture2 will be returned
This requirement does not facilitate communication; it isn’t Specification by Example because the examples are hidden in the fixtures!
It is possible to work around this by modifying the regex in the step definition so that the regex includes the data table, but that is rather clumsy.
Advantages
Behave supports most of the Gherkin syntax; in particular it does support data tables (even though it thinks that all data tables have a title row).
Behave doesn’t have a good parser; for example, it will be confused by this scenario title: