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 : public QObject { Q_OBJECT public: explicit TestSuite(const QString& _testName = ""); virtual ~TestSuite();
QString testName; static std::vector<TestSuite*>& testList...