7 From executable specifications to automated acceptance tests

 

This chapter covers

  • The basic principles of automating your scenario steps
  • The responsibilities of a step definition method
  • Implementing step definitions using Cucumber in Java and TypeScript
  • Setting up virtual environments for your tests

Over the previous few chapters, you’ve seen how the BDD lifecycle takes acceptance criteria and turns them into executable specifications. Acceptance criteria start as brief notes you write on the back of your story cards that help define when a story or feature is complete. During three-amigo sessions or other requirements discovery workshops, these notes are fleshed out into more complete examples and counter-examples that illustrate business rules and objectives. And as we saw in the previous chapter, you can write more complete versions of these acceptance criteria in the form of Gherkin scenarios, using the Given… When… Then notation[35].

7.1 Introduction to automating scenarios

 
 

7.1.1 Step definitions interpret the steps

 

7.2 Setting up your project

 
 

7.2.1 Setting up a Cucumber project in Java or TypeScript

 

7.2.2 Organizing a Cucumber project in Java

 
 
 

7.2.3 Organizing a Cucumber project in TypeScript

 
 

7.3 Running Cucumber scenarios

 
 
 

7.3.1 Cucumber test runner classes in Java

 
 
 

7.3.2 Running Cucumber scenarios in JavaScript and TypeScript

 
 
 
 

7.4 Writing Glue Code

 
 
 
 

7.4.1 Injecting data with step definition parameters

 
 

7.4.2 Making your Cucumber Expressions more flexible

 
 

7.4.3 Cucumber Expressions and Custom Parameter Types

 

7.4.4 Using Regular Expressions

 
 

7.4.5 Working with lists and data tables

 
 
 

7.5 Setting up and tearing down with backgrounds and hooks

 
 
 

7.5.1 Using Background Steps

 
 
 

7.5.2 Using Hooks

 
 

7.6 Preparing your test environments using hooks

 
 
 
 

7.6.1 Using in-memory databases

 
 
 

7.6.2 Using virtual test environments

 
 

7.6.3 Using TestContainers to manage Docker containers for your tests

 
 

7.7 Summary

 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest