English 中文(简体)
QT: simulated unit-testing
原标题:

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 somebody 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.




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签