O'Reilly logo

Learn Qt 5 by Nicholas Sherriff

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

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 ...

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