Chapter 10Databases

Back in Chapter 6, When Cucumbers Go Bad we described the risks associated with leaky scenarios, where data left behind by one scenario affects the results of the next. In this chapter we’re going to illustrate this problem with an example, and we’ll describe the two methods for dealing with it, along with their advantages and disadvantages.

For this final installment of the worked example, we’re going to introduce a relational database into our ATM system. Almost every system you’ll write Cucumber tests for will have a database of some kind, and it helps to know how to talk to it directly from your test code. You can use ActiveRecord to connect to almost any kind of database and set up or inspect its data from your ...

Get The Cucumber Book now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.