O'Reilly logo

Qt 5 Projects by Marco Piccolino

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing the GroceryItems entity

As described in Chapter 1, 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required