Folder structure for unit test



  • Hi,

    I would like to add unit test in my Qt application. https://github.com/labsquare/fastQt
    Actually, I have one qmake file which link several library, and contains specific OS rule .

    So, if I want to make unittest, is it possible to setup the current qmake file ? Or do I need to create 2 projects and use SUBDIRS keywords.

    I don't want to duplicate qmake file.


  • Lifetime Qt Champion

    Hi,

    In that case, I'd think a subdirs project would be better. That way you'll keep things clearly and cleanly separated.

    One possible setup could be to have the "core business" classes in a library that you can unit test and then an app subproject where you have the application code that uses the "core business" library.

    Hope it helps


  • Moderators

    I use cmake these days, but exactly what @SGaist said. Subdirs all the way.

    In cmake you can even go a step further and if testing is not enabled it won't include your test directories.

    I usually have a directory called unittest that contains my googletest/catch/cpputest (preference in that order) project and source.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.