[self SOLVED]using QTest::qExec() with parameters

  • In "QTestLib Manual":http://qt-project.org/doc/qt-4.8/qtestlib-manual.html#options it is specified that along with the test classes we can also specify some arguments like -functions , -xml etc. But how can we specity the same argument list if we run the test using

    @QTest::qExec(testClass,argument). @

    I need to store the list of functions in a testClass in a QStringList. I am able to use the arguments/parameters while running my test class through command prompt like testClass.exe -functions that returns the function list.

  • Finally after doing some search and thinking I am able to run QTest::qExec() with parameters. I am able to save the test results in different files both in .txt format as well as xml format.

    I got the following code working for my requirements

    For output as a file

    @QStringList testCmd;
    QDir testLogDir;
    testCmd<<" "<<"-o" <<"UnitTest_Results/test_log.txt";

    For xml output:

    @testCmd<<" "<<"-xml" <<"-o" <<"UnitTest_Results/test_log.xml";

    The above code is just for running a single testClass. But i am running multiple testClasses and writing the test output to the respective files.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.