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

Expressing the first acceptance test in QML

Now that you know a bit more about the structure of QML, here is what the same functional test that we wrote in C++ could look like in QML:

import QtTest 1.0TestCase {    name: "Usecases_check_available_groceries"    function test_one_or_more_grocery_items_available() {        // Given there is a list of available grocery items        var groceryItems = createTemporaryObject(groceryItemsComponent,this);        verify(groceryItems);        // Given one or more grocery items are available        var groceryItemsRepoDummy = createTemporaryObject(groceryItemsRepoDummyComponent, groceryItems);        groceryItems.repo = groceryItemsRepoDummy;        verify(groceryItemsRepoDummy.count > 0);        // When I check available groceries        var checkAvailableGroceries

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