Difference between revisions of "GUI Testing/Framework"

m (Framework)
Line 72: Line 72:
 
==Framework==
 
==Framework==
  
Since the framework covers the [[GUI Replay| replay]] part whose implementation is not yet defined, it should use an abstraction layer which can be easily adapted if necessary.
+
Since the framework covers the [[GUI Replay| replay]] part whose implementation is not yet defined, it should use an abstraction layer which so tests can easily be adapted if necessary.
  
 
===Common Functionality===
 
===Common Functionality===

Revision as of 08:57, 6 November 2006

Overview

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:

class EV_WIDGET
 
feature
 
  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'.
    require
      no_period_in_name: not a_name.has ('.')
    ensure
      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:

class EV_CONTAINER
 
feature
 
  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.

Framework

Since the framework covers the replay part whose implementation is not yet defined, it should use an abstraction layer which 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

Event Execution