I have a Qt Unit test (sub)project, which generates me one class (with the main generated by QTEST_APPLESS_MAIN
).I can start this from within Qt Creator as cons
I'm using the following code to collect all test results:
#include "testclassa.h"
#include "testclassb.h"
#include
#include
int main(int argc, char** argv){
int failedTests = 0;
TestClassA testClassA
TestClassB testClassB
failedTests += QTest::qExec(&testClassA, argc, argv);
failedTests += QTest::qExec(&testClassB, argc, argv);
if(failedTests > 0){
qDebug() << "total number of failed tests: " << failedTests;
}else{
qDebug() << "all tests passed :)";
}
return failedTests;
}