title: Qt: run unit tests from multiple test classes and summarize the output from all of them
body: <p>Qt comes with <code>QTest</code>, and there are some docs: for example, <a href="http://doc.qt.io/qt-5/qttestlib-tutorial1-example.html" rel="noreferrer">an official tutorial</a>.</p>
  
  <p>However, <code>QTest</code> encourages you to organize unit tests as separate executables. There is special macro for this, that generates <code>main()</code>: <code>QTEST_MAIN()</code></p>
  
  <p>To be honest, I really dislike this approach: generally, it is much more useful to run all tests at once, in order to make sure that recent changes haven't broken anything. <em>Sometimes</em>, it is useful to mask out some test or execute some individual test, but this is an exception, not the rule.</p>
  
  <p>So, I want to run all the tests at once. Ok, I can write my own <code>main()</code> that executes all tests I want, say, like this:</p>
  
  <pre><code>int main(int argc, char **argv)
  {
     int status = 0;
  
     //-- run all tests
     {
        TestHTCodecISO14230 tc;
        status |= QTest::qExec(&amp;tc, argc, argv);
     }
  
     {
        TestHTDataMsg tc;
        status |= QTest::qExec(&amp;tc, argc, argv);
     }
  
     return status;
  }
  </code></pre>
  
  <p>And it does run all tests, but the problem is that I don't have convenient summary of all tests. Say, for the two tests above, I have two separate summaries:</p>
  
  <pre><code>********* Start testing of TestHTCodecISO14230 *********
  Config: Using QtTest library 5.4.1, Qt 5.4.1 (i386-little_endian-ilp32 shared (dynamic) release build; by GCC 4.6.1)
  PASS   : TestHTCodecISO14230::initTestCase()
  PASS   : TestHTCodecISO14230::decode_summary()
  PASS   : TestHTCodecISO14230::encode()
  PASS   : TestHTCodecISO14230::decode_encoded()
  PASS   : TestHTCodecISO14230::cleanupTestCase()
  Totals: 5 passed, 0 failed, 0 skipped, 0 blacklisted
  ********* Finished testing of TestHTCodecISO14230 *********
  ********* Start testing of TestHTDataMsg *********
  Config: Using QtTest library 5.4.1, Qt 5.4.1 (i386-little_endian-ilp32 shared (dynamic) release build; by GCC 4.6.1)
  PASS   : TestHTDataMsg::initTestCase()
  PASS   : TestHTDataMsg::test1()
  PASS   : TestHTDataMsg::cleanupTestCase()
  Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted
  ********* Finished testing of TestHTDataMsg *********
  </code></pre>
  
  <p>The fact that returned <code>status</code> will be non-zero in case of error is surely helpful, but is would be much more helpful if I have summary as well:</p>
  
  <pre><code>Totals: 8 passed, 0 failed, 0 skipped, 0 blacklisted
  </code></pre>
  
  <p>From what I see, it is impossible: I can't find the way to programmatically get number of passed, failed, skipped and blacklisted tests: <code>qExec()</code> is just a function in the <code>QTest</code> namespace, so, it is impossible to gather some additional info after it executes.</p>
  
  <p>Well, it is possible to parse the output string, but, ugh...</p>
  
  <p>To me, it looks like poor design. It would be probably much better to make <code>QTest</code> as a class, then make instance of it and feed some test classes to it. Then, some additional information could be gathered from an instance.</p>
  
  <p>Or, maybe I've missed something.</p>
  
  <p>So, the question is: is it possible with <code>QTest</code> to have summary output of all unit test classes?</p>