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 ...
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.