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 a fake data repository

We already stressed several times the importance of keeping data retrieval separated from business logic. We now turn our attention to the data retrieval component (the repository) and build a fake implementation that we can use in our acceptance tests without having to access databases, files, or web resources.

In order to do so, we create a new subdirs project called repositories, as well as the corresponding repositories.pri file to keep source files separated from test harnesses and other kinds of resources:

# part1-whats_in_my_fridge.proTEMPLATE = subdirsSUBDIRS += \    usecases \     # gui \    entities \    repositories

Once we are done with it, since we'd typically want to have not only a fake repository, but ...

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