| Recipe 1 | Compare and Transform Tables of Data |
Problem
Your tests are in English, but your data is in HTML. What you and your stakeholders call a last name, your app calls customer_name_last. What you call February 24, your app calls 2012-02-24T10:24:57-08:00. You need to translate between the two.
Ingredients
-
Ast::Table,[13] Cucumber’s table-crunching workhorse
-
Ruby’s built-in BigDecimal for representing currencies[14]
Solution
In this recipe, we’ll assume we’re getting data from our app using a GUI automation library or web scraping framework. The data will be in whatever format the behind-the-scenes API provides. This format may be grisly, so we don’t want it in our human-readable Cucumber tests.
How do we address this mismatch between ...