Outside-in Testing
The process you’ll use to manage the feature tests is sometimes called outside-in testing—you use Capybara to write a test from the outside and use that test to drive your unit tests. In the same way that TDD uses a failing unit test to drive code, outside-in testing uses a failing acceptance test (or a failing line in an acceptance test) to drive the creation of unit tests.
The process is illustrated in the figure that follows—I’m assuming the creation of a new user-facing feature in a Rails application.
Let’s walk through the steps.
-
Write the end-to-end test that shows a user interacting with the new feature. This test should ...
Get Rails 5 Test Prescriptions 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.