[Qbs] Build QTests from single Product

resurrection at centrum.cz resurrection at centrum.cz
Wed Nov 8 09:28:30 CET 2017


In other testing frameworks like Google Test the test executable typically contains all test cases for the given module under test so there typically are as many products for tests as there are production modules. With QTest this is unsupported (although doable) and for good reasons too (mainly separation of test runs). As a result this requires each test case to be a separate executable and thus a separate Product under Qbs. While some code duplicity could be avoided by extracting most of the qbs code into custom item and instantiating that, the issue of the project list and the running executable(s) lists will be absolutely cluttered with every class being a separate Product (think Qt itself or even Qt Creator projects). Now the multiplexing sounds just like the right thing for this as one could pass the `files` property to `multiplexByQbsProperties` and it should work as expected building an executable for each file. Unfortunately that is not currently possible as `multipl
 exByQbsP
 roperties` is limited only to one of `["architectures", "buildVariants", "profiles"]`.
 
Incidentally this hints towards what I would absolutely love to see in Qbs and that is kind of there but not quite - dynamically defined Products. The multiplexing is just that - you defined a product and told Qbs to build it n times with these different settings. Custom items are almost that with the big limitation that you have to actually instantiate them manually rather than based on some property(ies). The QTest issue is a variation on this: "build this Product for every file in this list". Currently I need to go and instantiate the custom item manually for each test case. And it could be pushed a bit further by being able to say build this Product for every directory in this list with files being extracted dynamically etc. That would essentially remove the raison d'être for the qbs-autoproject that is doing exactly that - moving from manually defining each product to defining rules for a product type/category letting the build system to extract the project/products and
  build t
 hem.
 
So my ultimate question I guess is what are the plans regarding multiplexing? Will it be expanded into more general Qbs feature or kept limited to the special (Apple mainly) use case(s)? And what about the QTests?
 
Best wishes,
Michael



More information about the Qbs mailing list