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. How to run multiple unit tests from command-line?
QtWS25 Last Chance

How to run multiple unit tests from command-line?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qttestqmake
6 Posts 2 Posters 825 Views
  • 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.
  • P Offline
    P Offline
    Pixelgrease
    wrote on last edited by Pixelgrease
    #1

    I want to run all my unit tests (200+ files) from Jenkins. Can someone point me in the right direction?

    I'm researching this for the person who configures Jenkins... I don't know much about configuring Jenkins myself, but I hate it when other people break my tests.

    My project uses qmake and I run my suite of unit tests from QtCreator, or one at a time from the command prompt.

    I see a reference to "make check" in the Qt Test Overview page, is this what is used? I have no experience with "make check" and less-than-beginner experience with makefiles.

    I'm tempted to write a script to recursively execute the executables in the unit test build output folder but it feels like I'm inventing a new wheel.

    SGaistS 1 Reply Last reply
    0
    • P Pixelgrease

      I want to run all my unit tests (200+ files) from Jenkins. Can someone point me in the right direction?

      I'm researching this for the person who configures Jenkins... I don't know much about configuring Jenkins myself, but I hate it when other people break my tests.

      My project uses qmake and I run my suite of unit tests from QtCreator, or one at a time from the command prompt.

      I see a reference to "make check" in the Qt Test Overview page, is this what is used? I have no experience with "make check" and less-than-beginner experience with makefiles.

      I'm tempted to write a script to recursively execute the executables in the unit test build output folder but it feels like I'm inventing a new wheel.

      SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      The prepareRecursiveTarget might be what you want.

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

      P 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        The prepareRecursiveTarget might be what you want.

        P Offline
        P Offline
        Pixelgrease
        wrote on last edited by Pixelgrease
        #3

        @SGaist Per the documentation for prepareRecursiveTarget, I added a .qmake.conf in my project root as well as "features/mycheck.prf" with message() statements that show the value of $$_PRO_FILE_ and that verified each autotest project is processed.

        How does this get me closer to a testrunner for my build folder? It executes before I build so I cannot use it to run the testcases.

        I'm still stuck thinking that I need to build a testrunner. The automatic CONFIG injection into all subdirs is pretty sweet, but does this help me build a target that iterates through all subdirectories of the unit test output folder and execute each test case?

        Also, I don't understand the goal of check.commands = echo hello user.

        SGaistS 1 Reply Last reply
        0
        • P Pixelgrease referenced this topic on
        • P Pixelgrease

          @SGaist Per the documentation for prepareRecursiveTarget, I added a .qmake.conf in my project root as well as "features/mycheck.prf" with message() statements that show the value of $$_PRO_FILE_ and that verified each autotest project is processed.

          How does this get me closer to a testrunner for my build folder? It executes before I build so I cannot use it to run the testcases.

          I'm still stuck thinking that I need to build a testrunner. The automatic CONFIG injection into all subdirs is pretty sweet, but does this help me build a target that iterates through all subdirectories of the unit test output folder and execute each test case?

          Also, I don't understand the goal of check.commands = echo hello user.

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You won't have one single executable. The goal is to have a make target called check that will call the command defined.

          The example is just a dummy command that allows you to see that it is working. You have to adapt it to call your test binaries.

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

          P 1 Reply Last reply
          0
          • SGaistS SGaist

            You won't have one single executable. The goal is to have a make target called check that will call the command defined.

            The example is just a dummy command that allows you to see that it is working. You have to adapt it to call your test binaries.

            P Offline
            P Offline
            Pixelgrease
            wrote on last edited by Pixelgrease
            #5

            @SGaist Thank you very much for your assistance. Regrettably, I'm on another project today and don't know when or if I'll have to solve this problem.

            I looks like I have two possible approaches: use prepareRecursiveTarget() or write a script. My Jenkins admin is back so I handed off my research.

            BTW, reading the docs on prepareRecursiveTarget() introduced me to .qmake.conf which is incredible stuff -- I always wanted to know how to pass qmake variables to SUBDIRS projects. I'm looking for a synonym for "priceless".

            SGaistS 1 Reply Last reply
            0
            • P Pixelgrease

              @SGaist Thank you very much for your assistance. Regrettably, I'm on another project today and don't know when or if I'll have to solve this problem.

              I looks like I have two possible approaches: use prepareRecursiveTarget() or write a script. My Jenkins admin is back so I handed off my research.

              BTW, reading the docs on prepareRecursiveTarget() introduced me to .qmake.conf which is incredible stuff -- I always wanted to know how to pass qmake variables to SUBDIRS projects. I'm looking for a synonym for "priceless".

              SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Pixelgrease you might also want to consider migrating to cmake for the long run.

              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
              0

              • Login

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