Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Folder structure for unit test
Qt 6.11 is out! See what's new in the release blog

Folder structure for unit test

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 801 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dridk2
    wrote on last edited by dridk2
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • A Offline
        A Offline
        ambershark
        wrote on last edited by
        #3

        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.

        My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved