Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [self SOLVED]using QTest::qExec() with parameters
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 3.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sam
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Sam
      wrote on last edited by
      #2

      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;
      testLogDir.mkdir("UnitTest_Results");
      testCmd<<" "<<"-o" <<"UnitTest_Results/test_log.txt";
      QTest::qExec(myTestClass,testCmd);@

      For xml output:

      @testCmd<<" "<<"-xml" <<"-o" <<"UnitTest_Results/test_log.xml";
      QTest::qExec(myTestClass,testCmd);@

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved