Implementing the GroceryItems entity

As described in Chapter 23, Writing Acceptance Tests and Building a Visual Prototype, keeping data retrieval separate from business logic is very often a reasonable choice, which makes it possible to swap several kinds of backends (SQL, web service, and so on) without having to change the business rules. Additionally, using a lightweight, fake data backend (a so-called test double) in tests makes them run fast.

For these reasons, while writing the test for the usecase, we introduced a data repository object that would both function as a data feed for the GroceryItems entity (groceryItems->setRepository(groceryItemsRepoDummy)) and give an oracle against which we could check if all data was loaded (QCOMPARE ...

Get End to End GUI Development with Qt5 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.