Custom approach

The custom approach we will take still applies the same basic concepts we've just discussed.  At the heart of it, we will still have a test class that contains a suite of unit test methods to be executed. All we will do is supplement this with some additional boilerplate code to allow us to easily accommodate multiple test classes and pipe the output to files rather than the console.

Let’s begin by adding a new class TestSuite to cm-tests in the source folder:

test-suite.h:

#ifndef TESTSUITE_H
#define TESTSUITE_H
#include <QObject>
#include <QString>
#include <QtTest/QtTest>
#include <vector>
namespace cm {
class TestSuite ...

Get End to End GUI Development with Qt5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.