Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Getting the Qt Creator test scanner to find all test classes in one project
Forum Updated to NodeBB v4.3 + New Features

Getting the Qt Creator test scanner to find all test classes in one project

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
1 Posts 1 Posters 791 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sebastian M
    wrote on last edited by
    #1

    Our team uses Qt Creator. We have quite large projects, and for each project we have a test project with a test class for every production class. The main of the test project calls QTest::qExec for every test class. We run our tests by simply running the test project.

    That works fine, but the output is limited to the console, looking like this:

    ********* Start testing of TestClass1 *********
    Config: Using QtTest library 5.10.1, Qt 5.10.1 (x86_64-little_endian-lp64 shared (dynamic) debug build; by GCC 7.3.0)
    PASS   : TestClass1::initTestCase()
    PASS   : TestClass1::test1()
    PASS   : TestClass1::test2()
    PASS   : TestClass1::cleanupTestCase()
    Totals: 2 passed, 0 failed, 0 skipped, 0 blacklisted, 3ms
    ********* Finished testing of TestClass1*********
    ********* Start testing of TestClass2 *********
    Config: Using QtTest library 5.10.1, Qt 5.10.1 (x86_64-little_endian-lp64 shared (dynamic) debug build; by GCC 7.3.0)
    PASS   : TestClass2::initTestCase()
    PASS   : TestClass2::test1()
    PASS   : TestClass2::test2()
    PASS   : TestClass2::cleanupTestCase()
    Totals: 2 passed, 0 failed, 0 skipped, 0 blacklisted, 3ms
    ********* Finished testing of TestClass2*********
    

    I just discovered the integrated test gui and would really like to use it. However, I can't get the scanner (Tools->Tests->Rescan tests) to find all tests in a project. If I write this in the main it works fine for TestClass1:

    int main(int argc, char** argv) {
        TestClass1 test;
        return QTest::qExec(&test, argc, argv);
    }
    

    However, if I try to add TestClass2 as below the scanner only recognizes TestClass2:

    int main(int argc, char** argv) {
        TestClass1 test1;
        int ret = QTest::qExec(&test1, argc, argv);
        TestClass2 test2;
        int ret &= QTest::qExec(&test2, argc, argv);
        return ret;
    }
    

    It seem as if the scanner only finds the last class executed with QTest::qExec.

    Any idea how I could get it to find all tests, without touching the existing test classes?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved