[Qt-interest] Unit tests the Qt way

Robert Caldecott robert.caldecott at gmail.com
Mon Dec 20 14:41:40 CET 2010


I just tried 'make check' with some sample tests and it works a treat.

So I am now leaning towards a separate test project per-class, using the Qt
Creator Add Project wizard to create each test project.  I then, on the
advice of Rohan, changed the TARGET in the .pro file of each test project to
match the class being tested, though I am not sure why this actually helps.

I would like to see some real Qt test projects so I can use the same naming
conventions for the test class, project, etc.

Now all I need is the Qt AutoTester to be changed to support a setup like
this and I'll be very happy.  It would also be great if, given a project
containing subdirs of projects that have CONFIG += testcase, you could run
them all directly from Qt Creator...

On 20 December 2010 12:04, <Oliver.Knoll at comit.ch> wrote:

> On 2010-12-20 Robert Robert Caldecott wrote:
>
> > ...
> > The latest Qt Creator (2.1 RC) has better support for creating test
> projects and they
> > are also geared to a single test project per-class - which is significant
> I think.
>
> >From http://labs.qt.nokia.com/2010/10/29/making-auto-testing-easier/:
> "For instance, if you are patching something in QGraphicsView, you should
> compile and run individually 19 different auto-tests..."
>
> That was something I always wanted to avoid: I want to have ONE test *.exe
> which runs ALL tests defined for my project, or one test *.exe per
> DLL/shared library. And this test would then generate me a "nicely" rendered
> HTML page I could hook into some "continuous integration" system like
> Hudson, CruiseControl and the like.
>
> That said, if the Qt framework would provide an easy to apply solution to
> handle/generate one test *.exe per class (and these test *.exe would also
> link against the actual shared library to be tested), like this "Qt
> Autotester", so if this is really The Way To Go(tm) then that would be fine
> as well.
>
> But from what I understand the "Qt Autotester" is much geared towards Qt
> framework development itself, so it would need a little bit of tweaking to
> "read generic test *.pro files" :)
>
> I'll post my own experience here with QTestLib as well...
>
> Cheers, Oliver
> --
> Oliver Knoll
> Dipl. Informatik-Ing. ETH
> COMIT AG - ++41 79 520 95 22
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101220/f9da7565/attachment.html 


More information about the Qt-interest-old mailing list