1 Plan Generation for GUI Testing • The 21st International Conference on Software Engineering • The Fifth International Conference on Artificial Intelligence Planning and Scheduling • IEEE Transactions on Software Engineering 2 Research Focus GUI Interactions between the GUI and the Underlying Code Underlying Code 1
3 Why Planning for GUI Testing • GUIs are Event Driven • Individual User Events – NOT ENOUGH ! – Sequences of User Events lead to Different States • Test Case: Sequence of User Events • How to Generate Test Cases ? • Use Planning to Select Likely Test Cases 4 Selecting Test Sequences • Infinitely Many • Randomly Choose Sequences • Expert Chooses Sequences • Automatically Generate Events for COMMONLY USED TASKS Multiple Event Sequences This is the text. This is the text. Initial State Goal State 2
5 A Plan for a GUI Task SelectText(“This”) SetFontSize(18) This is the text. Initial State Goal State This is the text. This is the text. MouseClick( U ) SelectText(“text”) This is the text . 6 Outline • Using Planning for Test Case Generation – Overall Approach – Exploiting GUI Structure – Generating Alternative Test Cases • Experimental Results • Related Research • Concluding Remarks 3
7 Overview of Test Generation Phase Step Test Designer Automatic Planning-based System Setup 1 Derive Planning Operators from GUI 2 Code Preconditions and Effects of Operators Test Case 3 Specify a Task Generation (Initial and Goal States) 4 Generate Test Cases 8 Straightforward Approach • Define One Operator for each User Action Operator :: CUT Preconditions : File Edit View Ins isCurrent(Menu2). Menu1 Effects : FORALL Obj in Objects Selected(Obj) ⇒ Cut ⇒ ⇒ ⇒ ADD inClipboard(Obj) DEL onScreen(Obj) DEL Selected(Obj) ADD isCurrent(Menu1) DEL isCurrent(Menu2). Menu2 4
9 Exploit the GUI’s Structure • Reduce the Number of Operators – System more Efficient – Easier for the Test Designer 10 Opening Modal Windows Set Language English (United States) Default... OK Cancel 5
11 Opening Menus File Mail Recipient Send To Interacting with the 12 Underlying Software Edit Copy Underlying Software 6
13 Create Hierarchical Operators Two Types of Abstractions – Combine Buttons ⇒ ⇒ Create System- ⇒ ⇒ Interaction Operators – Decompose GUI Hierarchically ⇒ ⇒ Create ⇒ ⇒ Abstract Operators 14 Create System-Interaction Operators File Sys-Interaction Operator: File_SendTo_MailRecipient = <File + SendTo + MailRecipient > Mail Recipient Send To 7
15 Create Abstract Operators Set Language Straightforward English (United States) Approach Cancel Default... OK Main GUI’s Operator Set Using Abstraction … Language Window’s Set Language Main GUI’s Operator Set SelectFromList() Operator Set Default SelectFromList() OK … Default Cancel Set Language OK ... ... Cancel 16 Create Abstract Operators Language Window’s Operator Set SelectFromList() Default OK High Cancel ... SetLanguage() ... Level Plan Planner SelectFromList OK Sub Plan (“English(US)”) Define Abstraction SetLanguage() Abstract Operator 8
Effects of Exploiting the 17 GUI’s Structure • Reduction in Planning Operators – 325 operators ⇒ 32 operators – Ratio 10:1 for MS WordPad – 20:1 for MS Word • System Automatically Determines the System-interaction and Abstract Operators 18 Initial State This is the text. Goal State This is the text. 9
19 Test Case Abstract Primitive Abstract I Primitive G Operator Operator Operator N Operator O I SelectText FormatFont SelectText FormatFont A T (“This”) (“This”, 18pt) (“text”) (“text”, Underline) L I A L 20 Planner Planner FormatFont Underline OK FormatFont 18 OK 10
21 Mapping Mapping Font Format Format Font SelectText SelectText Format Font 18 OK (“This”) (“text”) Format Font Underline OK 22 Different from HTN Planning Primitive Abstract I Primitive Abstract G Operator Operator N Operator Operator O I SelectText FormatFont SelectText FormatFont A T (“This”) (“This”, 18pt) (“text”) (“text”, Underline) L I Planner Planner A FormatFont Underline OK L FormatFont 18 OK No Interactions 11
23 Alternative Test Case Abstract Primitive Abstract I Primitive G Operator Operator Operator N Operator O I SelectText FormatFont SelectText FormatFont A T (“This”) (“This”, 18pt) (“text”) (“text”, Underline) L I A L Primitive Abstract Primitive Primitive Operator Operator Operator Operator SelectText SelectFromList SelectText FormatFont (“This”) (18) (“text”) (“text”, Underline) SelectText SelectFromList SelectText (“This”) (18) (“text”) Format Font Underline OK Methods to Generate Alternative 24 Test Cases • Different Results from Planner • Abstract Operator Decompositions • Linearizations of the Partial-order Plan 12
25 Feasibility Study • Purpose – To Determine whether Planning is a Feasible Approach for GUI Test Case Generation • Execution Time • Human Effort • Experimental Design – GUI: MS WordPad – Planner: IPP [Koehler et al. ‘97] – Hardware Platform: 300 MHz Pentium based Machine, 200 MB RAM, Linux OS – 8 Tasks, Multiple Test Cases for each Task 26 Experimental Results (Task) Plan Sub Plan Total Plan Time Time Time No. (sec.) (sec.) (sec.) 1 3.16 0 3.16 2 3.17 0 3.17 3 3.2 0.01 3.21 4 3.38 0.01 3.39 5 3.44 0.02 3.46 6 4.09 0.04 4.13 7 8.88 0.02 8.9 8 40.47 0.04 40.51 13
27 Related Work • GUI Testing – FSM [Esmelioglu and Apfelbaum] and VFSM [Shahady and Siewiorek] Models. – Genetic Algorithm Technique [Kasik and George] – Visual TDE for GUIs [Foster, Goradia, Ostrand, and Szermer] • Planning for Testing – [Adele Howe, Anneliese Von Mayrhauser, Richard Mraz in ASE ‘97] 28 Concluding Remarks • Automatic Planning is a Feasible Approach for GUI Test Case Generation • Automatic Generation of Preconditions and Effects from GUI Specifications • Generate Expected Output (Automated Verification) 14
29 Coverage Criteria for GUI Testing 8th European Software Engineering Conference (ESEC) and 9th ACM SIGSOFT International Symposium on the Foundations of Software Engineering (FSE-9), Vienna University of Technology, Austria, Sept. 10-14, 2001. 30 Coverage Criteria • Two purposes – Test data selection criteria • Rules used to select test cases – Test data adequacy criteria • Rules used to determine how much testing has been done • Common Examples for Conventional Software – Statement coverage Structural – Branch coverage Representation – Path coverage of the Code 15
31 Coverage Criteria for GUIs • Cannot use code-based coverage – Source code not always available – Event-based input • Different level of abstraction • Our Contribution – Hierarchical structure of the GUI in terms of events – Coverage criteria based on events 32 Outline • GUI Definition • Representation of GUIs • Coverage Criteria • Case Study • Conclusions 16
33 GUI Definition • Hierarchical • Graphical Front-end • Accepts User-generated and System- generated events • Fixed sets of events • Deterministic Output • State of the GUI is the set of Objects and their Properties 34 GUI Representation • Motivation – GUI testing needs a “Unit of Testing” • Manageable • Test the unit comprehensively • Test interactions among units – GUIs are created using library elements • Need to test these elements before packaging them for reuse – Certain level of confidence that the element has been adequately tested • User of these elements should be able to test the element in its context of use 17
35 Model GUI Hierarchically • Hierarchy – GUIs are decomposed into a hierarchy of components – Hierarchical decomposition makes testing intuitive and efficient – Several hierarchical views of GUIs – We examine Modal Dialogs to create the hierarchical model 36 Modal Windows in GUIs Main 18
37 Modal Windows in GUIs Main invokes Print 38 Modal Windows in GUIs Main Components Print Properties 19
39 Integration Tree Main FileNew FileSave FileOpen PageSetup Print ViewOptions FormatFont Properties Definition Definition : : Integration tree Integration tree is a triple < is a triple < N N , , R R , , B B > > • • N N is the set of components in the GUI is the set of components in the GUI • R R є є N N is a designated component called the is a designated component called the Main Main component component • • B B is the set of directed edges showing the invokes relation is the set of directed edges showing the invokes relation • between components, i.e., (C between components, i.e., ( C x x , C , C y y ) ) є є B B iff iff C C x x invokes C invokes C y y . . 40 Representing a Component File Edit Help follows Open … Open … Cut About … Save Save Copy Contents … Paste Event-flow Graph Definition : Event e : Event e x follows e e y iff e e x can be performed Definition x follows y iff x can be performed immediately after e immediately after e y y . . 20
Recommend
More recommend