You are previewing Growing Object-Oriented Software, Guided by Tests.

Growing Object-Oriented Software, Guided by Tests

Cover of Growing Object-Oriented Software, Guided by Tests by Steve Freeman... Published by Addison-Wesley Professional
O'Reilly logo

Chapter 25. Testing Persistence

It is always during a passing state of mind that we make lasting resolutions.

—Marcel Proust

Introduction

As we saw in Chapter 8, when we define an abstraction in terms of a third-party API, we have to test that our abstraction behaves as we expect when integrated with that API, but cannot use our tests to get feedback about its design.

A common example is an abstraction implemented using a persistence mechanism, such as Object/Relational Mapping (ORM). ORM hides a lot of sophisticated functionality behind a simple API. When we build an abstraction upon an ORM, we need to test that our implementation sends correct queries, has correctly configured the mappings between our objects and the relational schema, uses ...

The best content for your career. Discover unlimited learning on demand for around $1/day.