Open egandunning opened 7 years ago
I have created a Qt Unit testing project to add tests to. It has it's own pro file, to use it you can navigate to the test folder inside our project folder, use the .pro file to import the project and run tests from there. From there to make a new test copy this code into your .cpp file, and no header is necessary.
class TestClass: public QObject { Q_OBJECT private slots: void findLetters(); };
void TestClass::findLetters(){ QString yo = "Yo"; QVERIFY(yo.toUpper() == "YO"); }
QTEST_MAIN(TestClass)
Notice that TestClass is the name of the .cpp file, and you should replace it with the name of your file. Be careful with the last include to make it all lowercase.
Use QtTest framework.
http://doc.qt.io/qt-5/qttest-index.html
http://doc.qt.io/qt-5/qtest-overview.html