[Interest] Unit testing: any best-practices tips ?

Ben Lau xbenlau at gmail.com
Tue Dec 13 16:49:29 CET 2011


Hi David,

I usually start a project with several modules. Each module will have its
own directory and a .pri file.

The .pri file will include the header , source , and add the current path
to include / depended path.

Then in the .pro file , call "include" to include those .pri file.

Example pri file:
http://bazaar.launchpad.net/~benlau/dquest/trunk/view/head:/src/dquest.pri

Instruction on using that pri.
http://code.google.com/p/d-quest/wiki/buildingdquest

Moreover, you may checkout the source code of dquest project. It has
several unit test program , each unit test program has its own .pro file.

On Tue, Dec 13, 2011 at 10:08 PM, David Heremans <
david.heremans at intersoft-electronics.com> wrote:

> Hello,
>
> So far I have used Qt in its most simple form. => one *.pro file to
> generate one executable.
> I've been reading about unit testing with qtestlib, but apparently for
> each unit test one should build its own executable etc etc.
>
> But how is this best implement in practice ?
>    a) copy around all the code you want to test in different
> directories and create a separate project for each test? This seems like
> a bad idea, I guess those files will be out of sync in a the shortest
> possible amount of time.
>    b) Create several *.pro files in you project directory tree, one for
> the project itself and one for each unit test?
>    c) Is it possible to have multiple targets in one pro file ? (And if
> so is this a Good Idea(TM)?)
>
> Can anybody give me some good advice on how to continue? Are there any
> good "DO's and DON'TS"  articles out there?
>
> Any hints will be greatly appreciated.
> Thanks.
>
> David H
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20111213/e0cb7121/attachment.html>


More information about the Interest mailing list