Efficient compilation of QtTest subprojects
-
Hello,
I am struggling with the structure that (as it seems) most people use with QtTest. I did some research on recommended usage and it mostly boils down to the procedure described in https://forum.qt.io/topic/89038/how-to-properly-structure-qttest-project which is to use a subdir project either per class or per "function".
In some examples the test projects include the whole project by using a shared .pri file with the main project. However that means that every subdir project will compile the whole project again and again for each test subproject.
Of course you can insert only needed files into the test projects yourself, but at the cost of managing all the files. And although we try to have as few as possible dependencies for our classes, for some bigger service classes you still need quite some other classes to use and test them.
So even then a lot of files would be compiled again and again for each test project where they are used. Which overall result in an immense time to compile all tests.
Is there any way to use the subdirs test structure but reduce the compile work to once per class for all tests? Or any other way to make this more time efficient?
Kind Regards
-
Hi,
Yes, put all your testable code in a library and then use it to build your tests in the same manner you use it for your application.