Presentation on theme: "Graphical User Interface Testing. Graphical User Interfaces A graphical user interface (GUI) is composed of objects (buttons, menus) using metaphors familiar."— Presentation transcript:
Graphical User Interfaces A graphical user interface (GUI) is composed of objects (buttons, menus) using metaphors familiar in real life. The software user interacts with the GUI objects by performing events that manipulate the GUI objects as one would do with the real objects. Events cause deterministic changes to the state of the software that may reflected by a change in the appearance of one or more GUI objects.
GUI Hierarchy GUIs, by their vary nature, are hierarchical. This hierarchy is reflected in the grouping of events in windows, dialogs, and hierarchical menus that can be tested in isolation. Since there are a large number of possible permutations of GUI events, this grouping of events decomposes GUI into manageable GUI components.
A Formal Definition of GUI A GUI is a hierarchical, graphical front-end to a software that accepts as input user- generated and system-generated events from a fixed set of events and produces deterministic graphical outputs. A GUI contains graphical objects and each object has a fixed set of properties. At any time during the execution of the GUI, these properties have discrete values, the set of which constitutes the state of the GUI.
Modal Windows A modal window is a GUI window that once invoked, monopolizes the GUI interaction, restricting the focus of the user to a specific range of events within the window, until the window is explicitly terminated. The language selection window in MS Word is an example of a modal window.
Modeless Windows Other windows in the GUI are called modeless windows that do not restrict the user’s focus; they merely expand the set of GUI events available to the user. In the MS Word, performing the event Replace opens a modeless window entitled Replace.
GUI Components At all times during interaction with the GUI, the user interacts with events within a modal dialog. This modal dialog consists of a modal window X and a set of modeless windows that have been invoked, either directly or indirectly by X. The modal dialog remains in place until X is explicitly terminated. Intuitively, the events within the modal dialog form a GUI component.
A Formal Definition of GUI Components A GUI component C is an ordered pair (RF, UF), where RF represents a modal window in terms of its events and UF is a set whose elements represent modeless windows also in terms of their events. Each element of UF is invoked either by an event in UF or RF. An example of a GUI component is the FileOpen modal window (and its associated modeless windows) found in most of today’s software.
Event Interleaving By definition, events within a component do not interleave with events in other components without the components being explicitly invoked or terminated.
Restricted-Focus Events Restricted–focus events open modal windows. The Set Language event in MS Word is an example.
Unrestricted – Focus Events Unrestricted–focus events open modeless windows. The Replace event in MS Word is an example. Modeless windows also need to be explicitly terminated.
Termination Events Termination events close modal windows. Common examples include the Ok and Cancel events.
Menu-Open Events Menu-open events are used to open menus. They expand the set of events available to the user. Menu-open events do not interact with the underlying software. Common examples include the File and Edit events.
System-Interaction Events System-interaction events interact with the underlying software to perform some action. Common examples include the Copy event used for copying objects to the clipboard.
An Example: MS WordPad Component Menu System Restricted Unrestricted Termination Sum Name Open Interaction Focus Focus Main 7 27 19 2 1 56 FileOpen 0 8 0 0 2 10 FileSave 0 8 0 0 2 10 Print 0 9 1 0 2 12 Properties 0 11 0 0 2 13 PageSetup 0 8 1 0 2 11 FormatFont 0 7 0 0 2 9 Sum 7 78 21 2 13 121
Event-Flow Graphs An event-flow graph for a GUI component C is a 4-tuple where: V is a set of vertices representing all the events in the components. E V V is a set of directed edges between vertices. (v x, v y ) E if v x immediately follows v y. B V is the set of events that are available when C is first invoked. I V is the set of restricted-focus events.
An Example: MS WordPad File Edit Help SaveOpen CopyPasteCut AboutContents To File, Edit and Help To File, Edit and Help
Integration Trees An integration tree is a 3-tuple, where: N is the set of components in the GUI. R N is a designated component called the Main component. We say that a component C x invokes component C y if C x contains a restricted-focus event e x that invokes C y. B N N is the set of directed edges showing the invoking relation between components.
An Example: MS WordPad Main PageSetupFileOpenFileSave Filenew ViewOptions FormatFont Print Properties
Intra-Component Coverage Criteria Event coverage: each event (or vertex) in the component is performed at least once. Event-interaction coverage: each edge (v x, v y ) in the component is performed at least once. Length-n event-sequence coverage: each event-sequence of length n is performed at least once.
Inter-Component Coverage Criteria Invocation coverage: each restricted-focus event in the GUI is performed at least once. Invocation-termination coverage: each length 2 event sequence (e i, e j ) in the GUI is performed at least once, where e i invokes component C x and e j terminates component C x. Intercomponent length-n event-sequence coverage: each event-sequence of length n that starts with an event in one component and ends with an event in another component is performed at least once.
GUI Testing Tools: GUITAR GUITAR is a GUI Testing Framework that presents a unified solution to the GUI testing problem. Our emphasis has been on developing new event-based tools and techniques for various phases of GUI testing. http://www.cs.umd.edu/~atif/GUITARWeb/
GUI Testing Tools: Abbot Abbot helps you test your Java UI. It comprises Abbot, which lets you programmatically drive UI components, and Costello (built on Abbot) which allows you to easily launch, explore and control an application. The framework may be used with both scripts and compiled code. http://abbot.sourceforge.net/doc/overview.sht ml
GUI Testing Tools: JFCUnit An extension to the JUnit framework that enables you to execute unit tests against code that presents a Swing GUI based interface. Recording and playback to/from XML allows novice GUI developers to generate and execute tests. https://sourceforge.net/projects/jfcunit/
GUI Testing Tools: UISpec4J UISpec4J is an Open Source functional and/or unit testing library for Swing-based Java applications, built on top of the JUnit test harness. http://www.uispec4j.org/index.html