[Qt-interest] Unit tests the Qt way

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Mon Dec 20 09:49:53 CET 2010


Hi Robert,

On 2010-12-17 Robert Robert Caldecott wrote:

> I am interested to know how the Qt team organize their unit tests.

I just want to backup your interest here, I am also wondering whether the Qt tests really have one separate *.exe test case per class. I haven't read the article on Qt Labs, but will do so right away.

As of now I also organised my tests such that multiple tests get linked into one *.exe, so there is one test *.exe per DLL/shared lib. But so far I only reached "proof of concept" stage.

Also it would be interesting to know if anyone here also makes use of reporting. On Qt Centre I once read a post describing how to integrate QTestLib with CruiseControl.

  http://www.qtcentre.org/wiki/index.php?title=Integrating_QTestLib_with_CruiseControl

But what about Hudson? Or plain HTML?

There is also a "hidden" switch when running QTestLib based tests: -xunitxml 
  (refer to http://bugreports.qt.nokia.com/browse/QTBUG-14305)

I once tried to convert this XML output to plain HTML with some XSLT I found in the XUnit distribution (I really had to dig it out of some jar file, AFAICR), but to no avail, the output was an almost empty HTML (unfortunately the XSLT implementation (XML patterns) of Qt choked on that XSLT, so I used libxml in the end, but that one produced the "empty" HTML, then I gave up).

Also refer to: http://www.mentby.com/oliver-knoll/qtestlib-xslt-for-transforming-output-into-html.html (my post on qt-interest about how to generate HTML output)

Note again that there is an "issue" which mentions an "existing" XSL-T which would render the QTestLib XML to HTML: http://bugreports.qt.nokia.com/browse/QTBUG-2684?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel - but that XSL-T is not attached unfortunately, and the "issue" is still unresolved.


Some other related links I just found:
https://bittyjava.wordpress.com/2010/03/10/a-basic-qtestlib-and-qexec-example-for-engineers-with-experience-in-q-a-not-qt/



Summary: I think the QTestLib framework deserves some more love and attention, and maybe some "best articles" in one of the upcoming Qt Quarterly? ;) Keywords: HTML output, integration into Hudson, CruiseControl, ... multiple tests in one *.exe vs one test *.exe per class etc.


Cheers, Oliver

--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22




More information about the Qt-interest-old mailing list