Andrew Knight

Behavior-Driven Python with pytest-bdd


Audience: All


Description:

Test automation is treated like a necessary evil. We know we should automate our tests, but it takes time and effort. **pytest-bdd**, a plugin for the awesome **pytest** framework, makes it *much* easier to write tests by enabling Behavior-Driven Development (BDD) features. Using **pytest-bdd**, teams write tests in plain language using Gherkin (e.g., Given-When-Then steps), and then programmers write Python code to automate the steps. BDD testing is great because tests are self-documenting and steps abide by the DRY principle. And all the goodness of **pytest** is available. An example test could be: *Given* the DuckDuckGo home page is displayed *When* the user searches the phrase "Python" *Then* search results for "Python" are shown This talk will teach how to use **pytest-bdd** to develop well-designed test scenarios and a robust automation framework. It will focus on the layers of the **pytest-bdd** framework: feature files, step definitions, and support classes. A full example project will be hosted on GitHub for audience members to reference after the talk.