PDA

View Full Version : Extending QtTest lib



davif
3rd November 2010, 08:34
Hi,
I'm using QtTest and I wish to have the test results printed on the Application output but also written on a XML file at the same time, but seems that this is not feasible by just passing the proper arguments to the command line.
Does anyone have any hints on how to achieve that?
Thank you

wysota
3rd November 2010, 09:00
I don't have any test at hand to verify that but essentially the information that is output as xml is the same as the one displayed in plain text so you can intercept the xml, output it to file and also print it to the console through some filter (using apps like "tee" might prove useful).

davif
3rd November 2010, 10:21
actually I can already output the tests result on a XML just passing the right arguments
./mytest -xml -o test.xml

But in doing this I don't get any output printed on the console, while I wish to have it along with the XML file.

I took a look to the QTEST_APPLESS_MAIN or QTEST_MAIN macros who run the tests through the QTest::qExec method but I cannot call that method twice (one for outputting on a file, one for the console), since it doesn't return the control to my application.

Any idea of how to achieve that as seamlessly as possible?

wysota
3rd November 2010, 10:36
That's why I said to use "tee" or a similar tool. Then you can skip the -o argument and have the test result output to the console and stored in a file at the same time.

davif
4th November 2010, 18:25
How can I deal with it if I'm running the testcase inside, for example, QtCreator?

wysota
4th November 2010, 19:45
You can configure the whole command line there as well. And you can always implement an appropriate plugin for Creator.