Index
1. Thanks
- This guide was created based on the course “Behavior Driven Python with pytest-bdd” by Andrew Knight.
- Course available at “Testing Automation University”.
2. BDD (Behavior Driven Development)
BDD (Behavior Driven Development) is an agile software development process.
It encourages better collaboration among the three amigos:
- Developers.
- QAs.
- POs (Product Owners) or BAs (Business Analysts).
The three amigos must be on the same page so that the feature is described, developed and tested the same way.
What should be accomplished by the three amigos doing meetings is described in the quote below.
What will bring value to the user is how the feature being developed behaves.
Behavior (feature function) = A scenario of inputs, actions and outcomes.
A product or feature exhibits countless behaviors.
3. Gherkin
Gherkin it’s a test specification language, not a programming language.
It uses a set of special keywords to give meaning and structure to executable specifications.
The structure of a gherkin file consists in describing the feature being tested, the scenarios that will be tested and its steps.
For more information of how gherkin works go to:
https://cucumber.io/docs/gherkin/reference/
4. BDD test frameworks
Based on the gherkin steps texts the BDD test frameworks glue each one of these steps to the programming language being used so that the BDD test frameworks can run all the scenarios like scripts.
List of some python BDD test frameworks:
- Behave (Similar to cucumber).
- Radish (More friendly for programmatic testing).
- Lettuce (Similar to cucumber, but the community is not very much active anymore).
- Pytest-bdd (Plugin for pytest).
The end.