Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8026785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:36:05+00:00 2026-06-04T23:36:05+00:00

I am using QTestLib Library and QTest for running my unit tests. I am

  • 0

I am using QTestLib Library and QTest for running my unit tests. I am working on windows 7 and using Qt 4.8 with the MVSC 2010 compiler.
When I run my test using:

QTest::qExec(TestDateDD/whateverTestClass);

I get the output in the console:

********* Start testing of TestDateDD *********
    Config: Using QTest library 4.8.0, Qt 4.8.0
    PASS   : TestDateDD::initTestCase()
    PASS   : TestDateDD::testValidity()
    FAIL!  : TestDateDD::testMonth(2012/7/10) Compared values are not the same
    Actual (date.longMonthName(date.month())): July
    Expected (monthname): June
    ..\UnitTestingPlugiin\TestDateDD.cpp(38) : failure location
    PASS   : TestDateDD::cleanupTestCase()
    Totals: 3 passed, 1 failed, 0 skipped
    ********* Finished testing of TestDateDD *********

However my requirement is to display this message in my GUI for each test slot. I did some research and found that the qtestlog.cpp uses its own messageHandler that manages the test outuput and displays the result as PASS or FAIL with the failure message,line number etc. Is there any way that I can handle this messageHandler of QTest for my GUI Application?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:36:06+00:00Added an answer on June 4, 2026 at 11:36 pm

    There’s no way of changing the logger’s functionality. The QAbstractTestLogger is hardcoded to either output to file or stdout, and you cannot supply your own implementation to QTestLog.

    You could redirect stdout to your textbox, or you could specify -o filename as an argument when you call QTest::qExec and read back the file as it’s being written out.

    However, I’d instead recommend that you compile your tests into separate executables and run them using QProcess. It inherits QIODevice and it shouldn’t be hard to send its data to your window.

    A couple other benefits of using QProcess are that a crash or an assert in the unit test won’t bring down your GUI, and that you’ll be able to run multiple tests at the same time without muddling your output.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently building a unit test suite for my application, using QTestLib . It's
I would like to use gcov with my unit test written using QTestLib. I
I am trying to write a unit test for a GUI application using the
I set my first steps upon the noble path of using unit tests to
Using mercurial, I've run into an odd problem where a line from one committer
Using Delphi 2010. I am looking for (possibly) a function or procedure which can
Using php's DOMDocument->LoadHTMLFile('test.html'); keeps on returning an error to me, reporting for an error
Using Google Maps InfoBox - http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/reference.html Currently the map will scroll - pan control
Using SQL Server 2005 Leave Table ID StartDate EndDate 001 02/03/2010 02/03/2010 002 02/03/2010
I'm writing unit tests for my app, and now I've stumbled on a class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.