Search code examples
c++qtctest

Why my Qt test (which uses a QProcess) fails?


I created a Qt test which invokes another program thanks to a QProcess. After calling the QProcess::start method, my test waits for it to finish with the QProcess::waitForFinished method. When I run this test with Qt Creator, there's no problem. But when I run it with CTest, the QProcess::waitForFinished function always returns false. Can someone explain me why ? Thank you.


Solution

  • Finally, I found a solution : the QProcess:start method couldn't find the program because the working directory of my Qt test wasn't good. So, I changed it with the QDir::setCurrent and now, it works.