Introduction to BDD

Why BDD?

Teams with poor communication and collaboration techniques are more likely to produce features that don’t match the business vision or that contain bugs. One of the most common causes of bugs and delays in projects is a lack of shared understanding of the software user requirements between product owners, developer and testers - accounting for 54% of defects in delivered software.

Applying BDD techniques ensures that requirements are understood by all members of the agile team – from day one and as the project evolves.

At a glance

This course focuses on the application of BDD techniques in agile software development projects, to help teams build software products that perform as they’re meant to.

Through a series of practical exercises, discussions and workshops, this course helps participants to translate business requirements into user stories that can be understood by everyone involved in the project. The course is delivered over 2 days, at your premises, for up to 20 people.

Course outcome

By the end of the course attendees will be able to:

  • Describe and apply the principles of BDD, including collaboration to achieve shared understanding of software requirements
  • Understand why requirements get interpreted differently, the cognitive biases behind it and how to use techniques to identify hidden users or actors within requirements
  • Work with Gherkin syntax to formulate examples that succinctly describe requirements and their behaviours, and convert them into automated acceptance tests using Cucumber-JVM
  • Understand BDD involvement throughout the software development lifecycle

Benefits of attending

The course offers specific benefits to different roles that, when combined, can make a team more effective in delivering a quality product:

  • Product owners will understand why requirements need examples and how to write them in the Given When Then format
  • Developers will be able to asks questions that discover examples and clarify requirements before development starts. They will also be able to use Cucumber-JVM to turn the examples into automated acceptance tests
  • Testers will learn how to use collaboration as a means to test ideas early, prevent defects and to identify risks for future testing activities

Course syllabus

Topics to be covered during the 2-day course will incorporate a range of activities based around understanding, application and analysis.

Day 1

This session is for anyone involved in the software development process who has an interest in improving the product development lifecycle.

It does not require any coding experience and is suitable for software developers, QA/ testers, business analysts, scrum developers and any other involved stakeholders.

Requirements problems

  • Describe the effects of misunderstood and badly formed requirements

Biases

  • Describe the types of biases and their effects during requirements gathering

Collaboration

  • Describe the value of teams collaborating on requirements
  • Implement different collaborative techniques to facilitate discussion

Gherkin/examples

  • Describe the different syntax rules of Gherkin
  • Describe the differences between imperative and declarative examples
  • Avoid common anti-patterns when using Gherkin

Questioning

  • Describe the value of questioning requirements to increase shared understanding
  • Demonstrate different questioning techniques
  • Assess answers and discussions from questions to create shared understanding

Actors

  • Describe the role of actors within requirements
  • Deduce different actors affected by requirements

Personas and roles

  • Distinguish different personas and roles affected by requirements

Clarifying requirements

  • Formulate examples that succinctly describe requirements and their behaviors
  • Use example mapping to help discover requirements from acceptance criteria

Day 2

This session is more technical with a focus on Cucumber-JVM, and is suitable for developers and testers.

Attendees should have basic knowledge of writing Java code to be able to understand the code examples and participate in the practical activities, although no previous knowledge of any existing testing framework or library is required.

Using Cucumber-JVM

  • Describe the role of step definitions in Cucumber-JVM
  • Construct step definitions and regular expressions
  • Select specific regular expressions to retrieve information from feature files
  • Use data created from scenario outlines
  • Use data created from tables and docstrings
  • How to use hooks within Cucumber-JVM
  • Construct hooks to handle state management of dependencies
  • Categorize scenarios by tags for execution
  • Choose a formatting option for reporting

Outside-in development

  • Describe the principles of outside-in development
  • Describe the anti-patterns of outside-in development
  • Assess whether outside-in development is suitable for your product

Imperative vs declarative steps

  • Write steps and share state between steps to enable the use of declarative steps within scenarios
  • Creating test data using the Test Data Builder pattern

Glue code: working with front ends

  • Use Selenium WebDriver to drive browsers for front-end/full stack outside-in development
  • Use visual checking libraries to drive front-end/full stack outside-in development comparisons

Glue code: working with back ends

  • Use specific design patterns with HTTP libraries for back-end outside-in development