Re: GTK program testing



Glenn Hutchings wrote:

Hi there, GTK fans!

I'm considering developing a GTK testing function that would "stress" a GUI by sending signals to widgets at random, to try to detect combinations of events that lead to an error or inconsistent state. The signals would simulate actions that could be performed by users (e.g. button presses, entering of text into entry widgets, selection of clist entries, etc). I have some questions that the GTK community can probably help me with:

* Does such a thing already exist? I seem to remember seeing some related functions at GDK level to record/playback events, but they seem to have gone away in recent versions of GTK.

* How difficult would it be? I envisage having a timer/idle function running which scans the widget hierarchy (getting all the toplevel windows from gtk_container_get_toplevels()) and selecting an "appropriate" widget at random to signal ("appropriate" meaning a widget that the user could normally interact with -- i.e. visible, active, etc). Would there need to be code for each widget type, or can signalling be made more generic?

* How useful would it be? I think there would have to be some way of recording/playing back the signals that led up to a failure, or tracking down bugs might be difficult.

I'm sure there are lots more problems I haven't thought of. But what are they?

The tough part in creating the kind of pseudorandom input that you'd need is defining the constraints that make it "sort of" reasonable ... I can envision that a simple generation of random signals to random widgets would tie GTK+ up in knots, since some widgets are probably going to expect that events happen in a certain order.

The SDPGTK library (http://www.k-3d.com), which is a C++ binding for GTK+, has considerable support for synthesizing user input ... though primarily for the purpose of providing recordable interactive tutorials for K-3D, a 3D modelling and animation application. A user can "turn on" recording, and user-interface events are recorded for later playback by the program's scripting engine; however, the recorded events are high-level events, such as "button X pressed", rather than GTK+ signals. If nothing else, the code may give you some suggestions on how to proceed.

The recorded tutorials in K-3D make excellent regression-testing tools, so, if you can solve the problem of generating sensible input, you may be on to something.

Cheers,
Timothy M. Shead





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]