How to run multiple unit tests from command-line?
-
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.
-
Hi,
The prepareRecursiveTarget might be what you want.
-
@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
. -
-
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.
-
@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". -
@Pixelgrease you might also want to consider migrating to cmake for the long run.