Presentation: Introduction to BDD in Python
This workshop introduces Behavior-Driven Development (BDD) in Python using behave and pytest-bdd. BDD helps teams write tests that are easy to understand and closely aligned with business requirements by using Given-When-Then scenarios in plain language.
BDD bridges the gap between developers, testers, and stakeholders by encouraging collaboration, promoting clean, well-tested code, and making test cases more meaningful and maintainable.
- Start by cloning the repo:
git clone <github-url-of-workshop-repo>
cd <name-of-repo>
Inside the repo folder, you can then create a virtual environment and install dependencies in your preferred way.
uv venv -p 3.8
uv lock # (optional)
uv sync --all-extras
source .venv/bin/activate # Or via IDE
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
You can test that the setup was successful by running
behave -q -o test.txt solutions/features
rm test.txt
If everything went well, you should see 3 features passed, 0 failed, 0 skipped
, followed by more lines.
Re-watch this YouTube stream
This workshop was set up by @pyladiesams and @gCaglia.