Instrumenting Qt applications
I'd like to make more informed decisions on how to improve our software. At the moment, we have very little data to support our decisions. One thing that I thought we might do, is actually measuring how people use our applications. That is: record every user action, how it is triggered, and when, and then collect and analyze this data to see how people navigate through our application (optional and anonymous, of course). Naturally, this should be done in the background; it should never interfere with the actual work of the user.
I was wondering what ways there are to do this, if possible in a way that doesn't interfere with our normal development practices too much. It would be annoying if developers would have to write special code everywhere to keep track of the actions, and that would basically make this idea impossible to sell to management here.
So, I am looking for ways to as much as possible automatically instrument applications. I guess I could to things like iterating over the object tree and finding all controls, QShortcut, and QAction objects. That would allow me to connect to their signals. Also possible are event filters to record events. But I am wondering how I am going to hook this all together into a consistent log that allows me to actually see something from that.
The overaching goal of all of this is to gain a much better understanding on how our users work with our application. What actions do they use most? Which actions are used together? How do they trigger them (mouse clicks, keyboard shortcuts?) What data fields are filled in in our forms, and which are left empty? I'd like to use such information to improve our software to better cater for these useage scenarios, and to get rid of snags or bumps in the workflows that are used.
Any suggestion is welcome!
In the "Foundations of Qt Development" book there is a chapter (Chapter 16: Unit Testing, 26 pages), what can help you.
In this chapter you can find:
user interaction testing (ie.: QTest::mouseClick( &spinBox, Qt::LeftButton, 0, upButton );)
you can simulate mouseclicks, keypress
data driven testing (fill with "dummy" user data for testing a form)
an so on.
You will have macros for testing: compare, verify, test and so on.
Of course, you have to build up a complete test environment for your project.
Hope this helps.
Thank you for your suggestion. Note that I am not after testing, but after use-research. However, you have put me on a track. Basically, a tool like FrogLogic's Squish does this kind of instrumentation when it is recording a macro. That gives me conficence that it is possible.
It also gave me an additional use for the idea: investigating bug reports. It might help me sell the idea of instrumentation if I argue that it can also be used to replicate bug reports by customers. After all, a look at a log of commands makes it much easier to replicate a scenario than having to rely on an oral description of what the customer did.
Hm, this FrogLogic’s "Squish":http://www.froglogic.com/squish/gui-testing/editions/qt.php seems to me quite a good tool, but it has some cost.
(But some features of Squish seems to me that Qt's own Unit Testing can do that too.)
Yes, but again: that is for testing, and that is not what I am after primarily. :-) I am also not saying that it is (too) expensive. I think it can be a huge cost saver to have automatic testing tools like that in place.