PDA

View Full Version : Unit tests can not be executed



Martin Drozdik
24th May 2012, 00:14
Hello,

I am having trouble executing the newly created template unit tests. By template I mean those created by the Qt Creator.

I create a new unit test the standard way:

File -> New file or project -> Other project -> Qt Unit test

and select everything default. The problem is that when I run the test from the Qt Creator, all that happens is that the Terminal (Ubuntu) opens. The terminal itself does nothing. It is just an empty console.

Previously, the behaviour was something like this:


********* Start testing of IntervalTest *********
Config: Using QTest library 4.8.1, Qt 4.8.1
PASS : IntervalTest::initTestCase()
PASS : IntervalTest::testContains()
PASS : IntervalTest::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped
********* Finished testing of IntervalTest *********

Int the "Application Output" of the Qt Creator. But now nothing happens.

I tried to compare the .pro files of old Unit tests that are running without problem but I cannot find any discernible difference. Also the build configurations seem to be the same.

I started having this problem only recently, so I have no Idea what is causing it. Please help. I am using gcc on Ubuntu.

ChrisW67
24th May 2012, 01:06
You'll probably find the output in the Qt Creator output pane if is is not appearing in the console.

If the terminal is not useful then in the Qt Creator run settings for the test executable untick the "Run in terminal" option.

Martin Drozdik
24th May 2012, 01:14
Thank you, but the problem is that there is no output in the pane. There is just:


Starting /home/martin/Projects/ExtendedRealLine-build-desktop-Qt_in_PATH_Debug/tst_extendedreallinetest...

And nothing else. The The program cannot even be debugged using the Qt Creator debugger. The unit test is "empty" so it should end in a fraction of second, but it continues to "run" until I terminate it

ChrisW67
24th May 2012, 01:40
Hmm, odd. The terminal window tends to hang around after the program terminates, displaying "Press <RETURN> to close this window..." (even if the program output nothing) on my machine. The template test code doesn't loop or do anything except run top-to-bottom. Perhaps the program is not being found or failing to start. Have you checked the run settings closely?

Can you run the compiled test program manually from a command prompt?

Martin Drozdik
24th May 2012, 02:09
So I tried to execute the test from the command line. It works. But suddenly when I tried to execute the test from the Qt Creator, I got


Cannot connect creator comm socket /tmp/qt_temp.jF2050/stub-socket: No such file or directory
Press <RETURN> to close this window...

In the previously blank Terminal window. After I unticked the "Run in terminal" option as you suggested earlier, I am able to run the test in the Qt Creator pane as usual. That is all I wanted :)

Thanks again!