[Interest] How to use unit testing with Qt framework properly

Gilles Habran gilleshabran at gmail.com
Mon Aug 6 09:00:20 CEST 2012


thank you for that !

I will check the link you gave me this week-end. I had to switch to a
project not Qt related which uses CxxTests with perl scripts to chose what
you want to run but I will need to master the QTestLib for my next Qt
project. :)

Kind regards,


On 2 August 2012 11:41, Bo Thorsen <bo at fioniasoftware.dk> wrote:

> Hi Gilles,
> This mail was sent quite a lot of months ago, but I hope you'll allow me
> to get back to it.
> Den 10-04-2012 16:19, Gilles Habran skrev:
>  thanks again for all the informations. I think I will create another
>> test project to experiment a lot with the Qt Test Lib and see what I can
>> do and not do.
>> I didn't understand how you call them automatically when you do
>> automated test proc. You have one main for each file (test class), do
>> you create another main somewhere that call all the tests ?
>> What I would like to achieve is
>> 1) run small unit tests for a class only for example
>> 2) run all the available tests in folder tests for example
>> I suppose I will have to do it your way.
>> Is it really a good way to do when you separate the app (I suppose the
>> main) and create a library with all the other class/... ? I am trying to
>> see the pros and cons of this. I checked with some KDE projects and I
>> only saw KTorrent with the separation. I will try to find projects that
>> use Qt test lib or KDE test lib (if such thing exists) and see how they
>> do it.
>> How should I do to link my main project with my tests projects if I
>> don't want to create a library for my main project ?
> I actually have a small but complete example of how you can do this with
> Qt: http://fioniasoftware.dk/**fseditor.html<http://fioniasoftware.dk/fseditor.html>
> .
> It's a small text editor, but the software itself is irrelevant. What's
> important here is all the things it puts together. Among other things, it
> has a unit test suite that runs as part of the build process. You can take
> a look at this and see how I choose to do it.
> I have had this up with a cmake based build for a long time. But I just
> published the qmake based version today (which is why I send this mail
> now). I'll post a blog entry on qmake versus cmake within a couple of days
> on the FS blog.
> I hope you or others find this useful.
> Bo Thorsen,
> Fionia Software.
> --
> Expert Qt and C++ developer for hire
> Contact me if you need expert Qt help
> http://www.fioniasoftware.dk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120806/d676b038/attachment.html>

More information about the Interest mailing list