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

Defining the precondition step

This is nothing less than the outcome of our first use case, checkAvailableGroceries. We will thus run that use case as a precondition for this one, and just check that the run is successful, as follows:

...void Usecases_add_grocery_item::test_item_can_be_added(){    // Given I am given a list of available groceries    auto checkAvailableGroceries = new usecases::CheckAvailableGroceries(groceryItems, this);    QSignalSpy checkAvailableGroceriesSuccess(checkAvailableGroceries,  &usecases::CheckAvailableGroceries::success);    checkAvailableGroceries->run();    QTRY_COMPARE_WITH_TIMEOUT(checkAvailableGroceriesSuccess.count(), 1, 1000);    delete checkAvailableGroceries;    ...}

Before doing that, though, we need to create the business ...

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