Pragmatic Behavior Driven Development
Description
Love your test suite again (or for the first time).
Have you ever met a developer who loves their test suite for their web app. There is subtle air of confidence surrounding them. They stand a bit taller; walk with a bit of a swagger.
This talk will put you on that path, by showing an approach of Behavior Driven Development using lettuce and selenium
Detailed Abstract
Behavior Driven Development (BDD) is a development process based on Test-Driven Development – but makes a significant modification. With TDD – the main goal was to achieve test-coverage (what percentage of your code is covered by tests). With BDD – the driving question – “What percentage of my user stories are covered?” The main test-unit is the user story.
1 2 3 4 5 6 7 8 9 10 11 |
|
With an application that leverages BDD, will have a set of feature files, and a feature file will have a collection of stories written is a specific format Given, When, Then.
Python has some tooling that helps turn this format into a fully automated test framework. We use lettuce to process feature files, and selenium to drive the web browser.
Outline:
Pragmatic Behavior Driven Development
Description
Love your test suite again (or for the first time).
Have you ever met a developer who loves their test suite for their web app? There is subtle air of confidence surrounding them. They stand a bit taller; walk with a bit of a swagger.
This talk will put you on that path by showing an approach of Behavior Driven Development using lettuce and selenium.
Detailed Abstract
Behavior Driven Development (BDD) is a development process based on Test-Driven Development – but makes a significant modification. With TDD – the main goal was to achieve test coverage (what percentage of your code is covered by tests). With BDD the driving question is “What percentage of my user stories are covered?” The main test unit is the user story.
1 2 3 4 5 6 7 8 9 10 11 |
|
With an application that leverages BDD, we will have a set of feature files, and a feature file will have a collection of stories written is a specific format: Given, When, Then.
Python has some tooling that helps turn this format into a fully automated test framework. We use lettuce to process feature files and selenium to drive the web browser.
Outline:
- Intro (5 mins)
- Who am I?
- 20 years of development and testing, and what I have seen over time
- Explain why BDD is an important evolution
- Writing your first Test (5 mins)
- Explain the Gherkin Format (Given, When, Then)
- Write your first test – watch it fail
- Given / When / Then (15 mins)
- Given: Using Factories to set up your data
- When: Trigger Events
- Then: Writing “Deterministic” assertions
- Setting up your testing environment (10 mins)
- The
terrain.py
file - Work around javascript timing issues with a selenium adaptor
- The
- Other tools to flesh out your test suite (5 mins)
- Coverage
- Flake8
- Travis (or CI)
- Unit Test Frameworks (such as nose)