Results 1 to 6 of 6

Thread: Extending QtTest lib

  1. #1
    Join Date
    Nov 2010
    Posts
    12
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Extending QtTest lib

    Hi,
    I'm using QtTest and I wish to have the test results printed on the Application output but also written on a XML file at the same time, but seems that this is not feasible by just passing the proper arguments to the command line.
    Does anyone have any hints on how to achieve that?
    Thank you

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Extending QtTest lib

    I don't have any test at hand to verify that but essentially the information that is output as xml is the same as the one displayed in plain text so you can intercept the xml, output it to file and also print it to the console through some filter (using apps like "tee" might prove useful).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Nov 2010
    Posts
    12
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Extending QtTest lib

    actually I can already output the tests result on a XML just passing the right arguments
    ./mytest -xml -o test.xml

    But in doing this I don't get any output printed on the console, while I wish to have it along with the XML file.

    I took a look to the QTEST_APPLESS_MAIN or QTEST_MAIN macros who run the tests through the QTest::qExec method but I cannot call that method twice (one for outputting on a file, one for the console), since it doesn't return the control to my application.

    Any idea of how to achieve that as seamlessly as possible?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Extending QtTest lib

    That's why I said to use "tee" or a similar tool. Then you can skip the -o argument and have the test result output to the console and stored in a file at the same time.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Nov 2010
    Posts
    12
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Extending QtTest lib

    How can I deal with it if I'm running the testcase inside, for example, QtCreator?

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Extending QtTest lib

    You can configure the whole command line there as well. And you can always implement an appropriate plugin for Creator.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. The following user says thank you to wysota for this useful post:

    BalaQT (13th May 2011)

Similar Threads

  1. QtTest and asserts
    By doberkofler in forum Qt Programming
    Replies: 11
    Last Post: 21st September 2010, 07:22
  2. QTTest and my own gui
    By GrahamLabdon in forum Newbie
    Replies: 0
    Last Post: 19th March 2010, 10:26
  3. QtTest example not compiling
    By GrahamLabdon in forum Newbie
    Replies: 3
    Last Post: 19th March 2010, 09:41
  4. QtTest - Am I missing the point
    By hubbobubbo in forum Qt Programming
    Replies: 3
    Last Post: 30th January 2010, 14:18
  5. QtTest bug
    By graeme in forum Qt Programming
    Replies: 4
    Last Post: 19th February 2006, 21:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.