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?
Forum Updated to NodeBB v4.3 + New Features

How to run multiple unit tests from command-line?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qttestqmake
6 Posts 2 Posters 882 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.
  • P Offline
    P Offline
    Pixelgrease
    wrote on 3 Jul 2023, 18:29 last edited by Pixelgrease 7 Mar 2023, 18:30
    #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.

    S 1 Reply Last reply 3 Jul 2023, 19:06
    0
    • P Pixelgrease
      3 Jul 2023, 18:29

      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.

      S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 3 Jul 2023, 19:06 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 4 Jul 2023, 00:40
      1
      • S SGaist
        3 Jul 2023, 19:06

        Hi,

        The prepareRecursiveTarget might be what you want.

        P Offline
        P Offline
        Pixelgrease
        wrote on 4 Jul 2023, 00:40 last edited by Pixelgrease 7 Apr 2023, 00:41
        #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.

        S 1 Reply Last reply 4 Jul 2023, 20:35
        0
        • P Pixelgrease referenced this topic on 4 Jul 2023, 01:18
        • P Pixelgrease
          4 Jul 2023, 00:40

          @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.

          S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 4 Jul 2023, 20:35 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 5 Jul 2023, 18:09
          0
          • S SGaist
            4 Jul 2023, 20:35

            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 5 Jul 2023, 18:09 last edited by Pixelgrease 7 May 2023, 18:13
            #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".

            S 1 Reply Last reply 5 Jul 2023, 18:27
            0
            • P Pixelgrease
              5 Jul 2023, 18:09

              @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".

              S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 5 Jul 2023, 18:27 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

              1/6

              3 Jul 2023, 18:29

              • Login

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