开发者

QT: simulated unit-testing

开发者 https://www.devze.com 2023-01-26 09:10 出处:网络
Is it possible to run an application and on top of that, you send keyPress events to the app and test the results using qtestlib?

Is it possible to run an application and on top of that, you send keyPress events to the app and test the results using qtestlib?

If yes, can somebody give me an example how to do it?

If no, can s开发者_运维技巧omebody show me a better way accomplish the above requirement?

Thanks...


Easy answer: No.

There are tools to do this however. Ivo mentioned Squish, there's also "native" testing application called QtUiTest which can be found here: http://qt.gitorious.org/+qa-tools/qt-labs/qa-tools-qtuitest .. and TDriver here: http://gitorious.org/tdriver


I would argue that what you are proposing is not unit testing, but system testing. There is certainly a place for system level tests of a GUI application, but you do have to understand the differences and limitations of full-program testing if you are coming from a unit-testing heavy background.

That being said, I really like froglogic's Squish. It has a number of neat features:

  • It directly accesses Qt objects, so there is generally little need for pixel based actions
    • This is specifically the problem with almost every other GUI testing tool, as Patrick mentioned in the comments to the original question.
  • It can be linked to your Qt library, if you have a custom version (we do :) )
  • Tests are scripted in Python (or tcl, or javascript, etc.)
  • Tests can be recorded based on mouse/keyboard actions.
    • Even these tests are in your scripting language, so they can be easily refactored or extended.
  • There are a variety of cool verification options.
  • It runs on Mac, Linux, and Windows (and I think iOS)
  • It can run in client/server mode, so you can start tests on a variety of machines from a single launch point (or from your build system).
  • froglogic has a list of what they think is cool, too.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号