Testing Apps



  • Probably a very basic question. I've looked around for help using QTest and pretty much the only example I can find is the test for QString which is not much help actually when trying to test a real App.

    For instance, I created a simple Qt App and QTest within a subdir project, and populated the MainWindow in the app with a label.

    I want to check that the label is there and the contents of that label should be a particular string in a test.

    I can't even create the form in the test to check the label. If I try creating the form with the default QTEST_APPLESS_MAIN macro I get a complaint that I need to instantiate an app first. If I use QTEST_MAIN, I get errors about 'undefined reference to vtable'

    I really wish there was an example testing an actual Application instead of QString. Can anyone point me to something I can use for help?

    I don't want a GUI tester like Squish. I want something I can create to use TDD patterns.

    Anyone else have problems with this?



  • I haven't used QTest but the error about instantiating an app might be because QLabel derives from QWidget which needs a QApplication instance to start the event loop.
    The 'undefined reference to vtable' is often related to the fact that the make files haven't been updated correctly to the code changes. You should try running qmake ([menubar] Build > Run qmake).


Log in to reply
 

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