Unit Testing in QTestLib - running single test / tests in class / all tests

Posted by Dave on Stack Overflow See other posts from Stack Overflow or by Dave
Published on 2010-04-21T20:30:19Z Indexed on 2010/04/21 20:33 UTC
Read the original article Hit count: 427

Filed under:
|
|

I'm just starting to use QTestLib. I have gone through the manual and tutorial. Although I understand how to create tests, I'm just not getting how to make those tests convenient to run. My unit test background is NUnit and MSTest. In those environments, it was trivial (using a GUI, at least) to alternate between running a single test, or all tests in a single test class, or all tests in the entire project, just by clicking the right button.

All I'm seeing in QTestLib is either you use the QTEST_MAIN macro to run the tests in a single class, then compile and test each file separately; or use QTest::qExec() in main() to define which objects to test, and then manually change that and recompile when you want to add/remove test classes.

I'm sure I'm missing something. I'd like to be able to easily:

  • Run a single test method
  • Run the tests in an entire class
  • Run all tests

Any of those would call the appropriate setup / teardown functions.

© Stack Overflow or respective owner

Related posts about qt

Related posts about qtestlib