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 first usecase

Our first usecase extracted from a scenario was check available groceries. We now want to define the class that represents the usecase. In order to do that, we look at the object's API that we consume in the test_one_or_more_grocery_items_available() test:

// tst_check_available_groceries.cpp...// When I check available groceriesauto checkAvailableGroceries = new usecases::CheckAvailableGroceries(groceryItems, this);QSignalSpy checkAvailableGroceriesSuccess(checkAvailableGroceries, &usecases::CheckAvailableGroceries::success);checkAvailableGroceries->run();QTRY_COMPARE_WITH_TIMEOUT(checkAvailableGroceriesSuccess.count(), 1, 1000);...

Here is the API we are consuming:

  • A constructor (CheckAvailableGroceries(groceryItems, ...

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