GUI Testing/Framework

Revision as of 11:27, 6 November 2006 by Juliant (Talk | contribs) (Event Execution)


The framework should facilitate retrieval of widgets and sending of events to a known GUI. This can be used to create a GUI test by hand.

Since it is not yet clear how to do the replay of an event sequence, the framework should use an abstraction layer to later change the way this is handled. The first implementation will consist of the simplest way where the executing test is compiled and run together with the application.

Vision2 Changes

In order to find widgets by name, widgets first need to have a name. Vision2 has to be extended accordingly by adding a name feature to the widgets. Proposed as follows:

  name: STRING
      -- Name of the widget
      -- If no specific name is set, the class type will be returned.
  full_path: STRING
      -- Full name of widget by prepending names of parent widgets
      -- Uses '.' as a separator.
  set_name (a_name: STRING)
      -- Set `name' to `a_name'.
      no_period_in_name: not a_name.has ('.')
      name_set: name = a_name

It remains to be checked if this should be inserted into EV_WIDGET or EV_ANY. To find widgets when having their name the container class can be extended by searching functionality:

  find_widget_by_name (a_name: STRING): EV_WIDGET
      -- Find a widget in container with `a_name'.
      -- Sets `last_widget' to the found widget or Void if no widget was found with `a_name'.
  find_widget_by_name_recursive (a_name: STRING): EV_WIDGET
      -- Find a widget in container with `a_name' and search recursive.
      -- Recursive search is a breadth-first.
  find_widget_by_path (a_path: STRING): EV_WIDGET
      -- Find a widget which corresponds to `a_path'.
      -- The path will be split on periods and looked up accordingly.
      -- Asteriks can be used in the path as placeholders. If a part of the path is a class name
      -- all widgets which correspond to this class will be used to look further for the widget.
      -- A breadth-first search is used and the first result which matches `a_path' is returned.
  find_all_widgets_by_name (a_name: STRING): LIST [EV_WIDGET]
      -- TODO
  find_all_widgets_by_name_recursive (a_name: STRING): LIST [EV_WIDGET]
      -- TODO
  find_all_widgets_by_path (a_path: STRING): LIST [EV_WIDGET]
      -- TODO

It remains to be checked if regular expression support should be implemented in the search instead of the simple placeholder '*'.

wel and gtk

Both implementations of Vision2 - wel and gtk - have a support for names on the widget level. Thus it should not be a problem to add this functionality to Vision2.


Since the framework covers the replay part whose implementation is not yet defined, it should use an abstraction layer so tests can easily be adapted if necessary.

Common Functionality

  • Launch the application
    • If test and AUT are separate this needs to invoke a program by name
    • If test and AUT are compiled together, this needs to instantiate the original root class and call its creation feature. Threads could make a problem since the normal Vision2 application uses the thread for the event loop. So the test either has to create a thread for its actions or somehow be called from the Vision2 event loop.

Widget Retrieval

  • Get a widget
    • By name or path in the whole application
      this includes searching for windows and dialogs
    • By name or path in a specific widget
      this includes searching in a specific window or dialog
    • By class
    • By name or path and class
    • Maybe: By specifying other attributes
      A search for icon, size, position, activation status or other attributes can be imagined
    • Maybe: By specifying a prototype
      A widget is created and the attributes like size and icon are set. Then a widget with these properties is searched for.
  • Get a list of widgets
    • (Same as above but always return all widgets which conform to the query)
  • Get current focus
  • Get menu (easy access on menubar)

Event Execution

  • Invoke event
    • On the whole application
      mouse events with coordinates relative to application
      keyboard commands issued on current focus
    • On specific widget
      mouse events with coordinates relative to widget
      keyboard commands issued on specific widget (maybe focus should change automatically to better simulate behaviour)
  • Keyboard events
    • Issue a list of keyboard events by string (no need to issue every single key stroke)
    • Implement a way of describing which modifers are pressed
  • Mouse events
    • Clicks
    • Movement
    • Dragging
  • Mode where some events can be infered
    When two mouse clicks happen on different coordinates, the framework can issue mouse movement events between the positions to better simulate the user behaviour. This can be made as an option which can be activated or deactivated.

Class layout

Single Test