Recipe 18Drive a Spring + Hibernate Project

Problem

You want use Cucumber to test a Java application using Spring and Hibernate for persistence. You want your tests to be isolated by database transactions so that your data doesn’t leak from test to test.

Ingredients

  • The Spring application development framework[111]

  • The Hibernate ORM library[112]

  • A database system such as HSQLDB[113]

  • Cucumber-JVM[114] to drive your Java code from Cucumber

  • Maven[115] to install the libraries you’ll need

Solution

Building an app with Spring can save you a lot of time, but you need to coordinate several moving parts: object-relational mappings, database transactions, and so on. In this recipe, we’re going to put together a Cucumber test to drive just one aspect of ...

Get Cucumber Recipes 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.