Search code examples
c++qtunit-testingeclipse-cdt

Running multiple Qt tests in eclipse


I am setting up tests for a big Qt (4.8.x) project and want to run qt unit tests inside Eclipse (JUNO). Therefor I installed C/C++ Unit Testing Support. I created a sub project which contains 3 test cases in 3 classes/files. Since I am able to build a test application I added a new "Run Configuration" to eclipse choosing the "Qt Tests Runner".

Now I am able to start/run the tests in Eclipse but Eclipse only shows the resuls of one class and then stops with the error:

XML parse error:: The procession instruction target matching "[xX][mM][lL]" is not allowed

I ran the Qt test binary with -xml and found out that the application output is 3 complete xml documents instead of one. I think thats the problem but how can I fix this?


Solution

  • Do you have multiple test classes run from the same executable? As far as I know every time you call QTest::qExec() QTest treats it as a complete test.

    I think what they were aiming for with QTest was one executable per test class instead. I haven't found a way around this yet, but you may get away with either doing what QTest wants (one executable per test class) or switching to googletest.