GUI Testing Phan Thế Vinh - 1051023 Nguyễn Quang Nhật – 1051012.

Slides:



Advertisements
Similar presentations
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Advertisements

CS0004: Introduction to Programming Visual Studio 2010 and Controls.
Testing Object Oriented Programs CSE 111 4/28/20151.
Selenium HP Web Test Tool Training
© by Pearson Education, Inc. All Rights Reserved.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
GUI-based Testing Alessandro Marchetto Fondazione Bruno Kessler - IRST.
XP Information Technology Center - KFUPM1 Microsoft Office FrontPage 2003 Creating a Web Site.
1 Chapter 12 Working With Access 2000 on the Internet.
CS 290C: Formal Models for Web Software Lecture 10: Language Based Modeling and Analysis of Navigation Errors Instructor: Tevfik Bultan.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
1 State-Based Testing of Ajax Web Applications A. Marchetto, P. Tonella and F. Ricca CMSC737 Spring 2008 Shashvat A Thakor.
EValid Getting Started. Agenda Introduction to eValid First experience of using eValid Recording and Site Analysis in eValid.
Selenium – Testing Tool. What is Selenium? Selenium is a robust set of tools that supports rapid development of test automation for web-based applications.
Lesson 46: Using Information From the Web copy and paste information from a Web site print a Web page download information from a Web site customize Web.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
2. Introduction to the Visual Studio.NET IDE 2. Introduction to the Visual Studio.NET IDE Ch2 – Deitel’s Book.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Sikuli Ivailo Dinkov QA Engineer PhoneX Team Telerik QA Academy.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 16: Java Applets & AWT Fundamentals of Web Programming.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Dynamic Action with Macromedia Dreamweaver MX Barry Sosinsky Valda Hilley.
What is Sure BDCs? BDC stands for Batch Data Communication and is also known as Batch Input. It is a technique for mass input of data into SAP by simulating.
Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.
© 2012 LogiGear Corporation. All Rights Reserved Robot framework.
Testing Web applications. Selenium What is Selenium? Selenium is a suite of tools to automate web application testing across many platforms Tests run.
Department of Mechanical Engineering, LSUSession VII MATLAB Tutorials Session VIII Graphical User Interface using MATLAB Rajeev Madazhy
JavaScript II ECT 270 Robin Burke. Outline JavaScript review Processing Syntax Events and event handling Form validation.
IE 411/511: Visual Programming for Industrial Applications
Capture and Replay Often used for regression test development –Tool used to capture interactions with the system under test. –Inputs must be captured;
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
Copyright © 2007, Oracle. All rights reserved. Managing Concurrent Requests.
Automated GUI testing How to test an interactive application automatically?
Designing Interface Components. Components Navigation components - the user uses these components to give instructions. Input – Components that are used.
Domain 3 Understanding the Adobe Dreamweaver CS5 Interface.
Exploring an Open Source Automation Framework Implementation.
In the next step you will enter some data records into the table. This can be done easily using the ‘Data Browser’. The data browser can be accessed via.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
Software Construction Lecture 18 Software Testing.
Automated GUI testing How to test an interactive application automatically?
Selenium Web Test Tool Training Using Ruby Language Discover the automating power of Selenium Kavin School Kavin School Presents: Presented by: Kangeyan.
Chapter 12: User Interface Design
Testing Web Applications. Plan The presentation covers: Selenium framework Spring MVC Test framework HttpUnit framework.
Selenium and Selenium on Rails. Agenda  Overview of Selenium Simple Selenium Tests Selenium IDE  Overview of Selenium on Rails  Problems with Selenium.
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
11/25/2015Slide 1 Scripts are short programs that repeat sequences of SPSS commands. SPSS includes a computer language called Sax Basic for the creation.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
Selenium January Selenium course content  Introduction (Session-1)Session-  Automation  What is automation testing  When to go for automation.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 7 1 Microsoft Office FrontPage 2003 Tutorial 8 – Integrating a Database with a FrontPage.
Introduction Selenium IDE is a Firefox extension that allows you to record, edit, and debug tests for HTML Easy record and playback Intelligent field selection.
Web Design and Development. World Wide Web  World Wide Web (WWW or W3), collection of globally distributed text and multimedia documents and files 
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
Modal Dialogs. What is a Modal Dialog? A modal dialog is a separate window that remains in focus until it is closed by the user. During this time the.
HTTPUNIT. What is HTTPUNIT HttpUnit is an open source software testing framework used to perform testing of web sites without the need for a web browser.
Microsoft Office 2013 Try It! Chapter 4 Storing Data in Access.
Quick Test Professional 9.2. Testing Process Preparing to Record Recording Enhancing a Test Debugging Running the Test and Analyzing the Results Reporting.
Test Automation Using Selenium Presented by: Shambo Ghosh Ankit Sachan Samapti Sinhamahapatra Akshay Kotawala.
Microsoft Office 2008 for Mac – Illustrated Unit D: Getting Started with Safari.
Chapter 28. Copyright 2003, Paradigm Publishing Inc. CHAPTER 28 BACKNEXTEND 28-2 LINKS TO OBJECTIVES Table Calculations Table Properties Fields in a Table.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
Dive Into® Visual Basic 2010 Express
JRA2: Acceptance Testing senarious
Working in the Forms Developer Environment
Gannon University Frank Xu
DB Implementation: MS Access Forms
Introduction to AppInventor
Web Application Development Using PHP
Selenium IDE Installation and Use.
Presentation transcript:

GUI Testing Phan Thế Vinh Nguyễn Quang Nhật –

Outline What is GUI? -> GUI Testing? GUI Testing types GUI Testing approaches GUI Testing oracles GUI Testing tools 2

G.U.I – Graphical User Interface How programs interacts with user How the user actions are performed to access application's features 3

G.U.I – Graphical User Interface Is a hierarchical, graphical front end to a software system During the execution  The GUI state: {… (w, p, v), …} w: widgets (graphical object) p: set of properties v: discrete value 4

5 GUI Testing Whether application responds in functionally correct manner Input Program GUI Correct? Expected = Obtained?

6 GUI Testing  Non-GUI testing: suites are composed of test cases that invoke methods of the system and catch the return values;  GUI testing: suites are composed of test cases that are:  able to identify the components of a GUI;  able to exercise GUI events (mouse clicks,…);  able to provide inputs to the GUI components (filling text fields,…);  able to test the functionality underlying a GUI set of components;  able to check the GUI representations  often, strongly dependent on the used technology;

7 GUI Testing : Type System testing  Test the whole system Acceptance testing  Accept the system Regression testing  Test the system changes

8 Acceptance Testing Acceptance Tests are specified by the customer and analyst to test that the overall system is functioning as required (Do developers build the right system?). Manual Acceptance testing: User exercises manually Acceptance testing with “GUI Test Drivers” (at the GUI level). Tools help the developer do acceptance testing through a user interface Table-based acceptance testing. Customer enters in a table the expectations of the program’s behaviour Black-Box (aka functional) approaches Define test specification then executed manually, by means of the GUI or by table-based testing.

9 Approaches for GUI Testing Manual Based on the domain and application knowledge of the tester Capture and Replay Based on capture and replay of user sessions Model testing Based on the execution of user sessions selected from a model of the GUI  Which type of model to use?  Event-based model  State-based model  Domain model  How do obtain the model to be used?  Specification-based model  Model recovered from existing software systems  Log-based model

10 Event-based Model Model the space of GUI event interactions as a graph Given a GUI: 1.create a graph model of all the possible sequences that a user can execute 2.use the model to generate event sequences

11 Event-based Model File NewOpenSave … Edit Cut CopyPasteReplaceUndo … Editbox0 Editbox1 Match case Find nextReplace Replace all Cancel Top level TC: Oracle: & !CRASH “Event-flow graph”

12 Event-based Model Model Type:  Complete event-model  Partial event-model Event types:  Structural events (Edit, Replace)  Termination events (Ok, cancel)  System interaction events (Editbox0, Find next) Coverage criteria  Event coverage  Event coverage according the exercised functionality  Coverage of semantically interactive events  2-way, 3-way coverage  ….

13 State-based Model Model the space of GUI event interactions as a state model, e.g., by using a finite state machine (FSM): States are screenshot/representation of the GUI Transitions are GUI events that change the GUI state Given a GUI: 1.create a FSM of the possible sequences that a user can execute, considering the GUI state 2.use the FSM to generate event sequences e1 e2 e3 e4 e5

14 State-based Model FSM: - State: GUI screenshot -Transition: event that changes the GUI state

15..example Problem: state explosion!  Use of a state abstraction function It maps concrete states into abstract states (i.e., sets of concrete states)

16 Log-based Recovered Model How do obtain the model?  starting from system specification or requirements  starting from the system (i.e., reverse engineering) 1. trace some system executions (at method calls level) 2. infer a model 3. refine it manually, if needed

17 Test oracles for GUI-based testing It could be difficult to detect faults looking the GUI  Crash testing is often used; In a GUI test case, an incorrect GUI states can take the user to an unexpected/wrong interface screen or it can make the user unable to do a specific action;  e.g., after the click of a button, we try to click the button again but we fail since the button no longer exists, after the first click. A GUI state can be “represented” by the components expected to be part of the GUI in a give time and their state/value e.g., window position, GUI objects, GUI title, GUI content, GUI screenshots,

18 GUI errors: examples Incorrect functioning Missing commands (e.g., GUI events) Incorrect GUI screenshots/states The absence of mandatory UI components (e.g., text fields and buttons) Incorrect default values for fields or UI objects Data validation errors Incorrect messages to the user, after errors Wrong UI construction ….

19 GUI-based Testing: process 1. Identify the testing objective by defining a coverage criteria 2. Generate test cases from GUI structure, specification, model  Generate sequences of GUI events  Complete them with inputs and expected oracles 3. Define executable test cases 4. Run them and check the results

20 GUI-based Regression Testing GUI-based testing means to execute the GUI of a system exercising its GUI components; A small changes in the GUI layout can make the GUI test cases old and useless; Hence, GUI-based test suite need to be maintained and often chagned  supporting tools are welcomed Often, GUIs are realized by means of rapid prototyping or automatic framework. This requires an efficient approach to generate and maintain GUI test suite  supporting tools are welcomed

21 Capture and Replay A capture and replay testing tool captures user sessions (user inputs and events) and store them in scripts (one per session) suitable to be used to replay the user session. An ad-hoc infrastructure is needed to intercept GUI events, GUI states, thus storing user sessions and also to be able to replay them. - they can work at application or VM level

22 Recorded information Inputs, outputs, and other information needed to replay a user session need to be recorded during the capture process. Examples:  General information: date/time of recording, etc.  System start-up information  Events from test tool to system  Point of control, event  Events from system to test tool  Checkpoints / expected outputs  Time stamps

23 Capture and Replay: the process 1. The tester interacts with the system GUI to run the system, thus generating sessions of sequence of mouse clicks, UI and keyboard events; 2. The tool captures and stores the user events and the GUI screenshots; a script is produced per each user session 3. The tester can automatically replay the execution by running the script the script can be also changed by the tester the script can be enriched with expected output, checkpoints the script can be replicated to generate many variants (e.g., changing the input values) 4. In case of GUI changes, the script must be updated

24 Marathon Abbot Guitar HtmlUnit, HttpUnit,JWebUnit HtmlFixture Selenium …. Tools for GUI-based testing Java Web

25 Calc_1 : Logic mixed to GUI GUI realized by using Swing Calc_2 : Logic mixed to GUI GUI realized by using AWT Calc_3 : Logic separated from the GUI GUI realized by using AWT +Swing Running Example: Calculator These apps are from the net hence please refer to the author’s copyright

26  Is a tool that helps writing System/GUI tests for Java/Swing applications  Consists of a recorder, player, and an editor  Records tests script in Python It is possible to use it without knowing Python …  Allows to insert assertions in the script easily Using a specific GUI  Shows testing results using JUnit’s control bar Red/green  download Marathon and its user manual Marathon

27 Marathon example (1) A calculator application was developed (Swing) We want to write tests for the calculator  Ex. add two values Steps: 1. create a new Marathon project 2. create a new empty test (a test is a Python script file) 3. build the test (recording)

28 Marathon example (2) Record the script click on the record button in the toolbar – the red circle enter “ =”, the result is displayed (16) press control + right-click in the text area, to open the contextual menu select Assert Text stop recording (the button with a red square), the script now looks like: save the script

29 Marathon example (3) Run the script Select the “JUnit” tab Click the test view, you should see your new created test Click on the “Run all tests” button, in the JUnit’s control bar and … get the green bar …

30 Abbot  Is a tool that helps writing System/GUI tests for Java AWT/Swing applications  Consists of a recorder, player, and an editor (via Costello, built on top of Abbot)  Records tests script in Java  Allows to write test cases directly from Java code (named programmatic GUI testing)  Allows to insert assertions in the script easily  Shows testing results using JUnit’s control bar  Red/green  Two main building blocks:  ComponentReferences to get a handle on a GUI component  Robot: to perform user-level actions on various GUI components  download Marathon and its user manual

31 Abbot example (1) A calculator application was developed (AWT/Swing) We want to write tests for the calculator  Ex. add two values Steps: 1.create a new empty Abbot test 2.Initialize the test with the application under test information 3. build the test (recording)

32 Abbot example (2) Recording 1. Start recording of all actions 2. Execute the software 3. Add assertions 1. select the GUI element with SHIFT+F1 2. select the property (e.g., (“Text”) 3. set the expected value 4. Stop recording

33 Guitar A testing framework implementing the “Event- flow graph” approach Four main components: The GUIRipper: extract GUI information from a program The GUIStructure2Graph: build a traversable graph representation of the GUI elements The TestCaseGenerator: create an extensive set of test cases based on the graph The GUIReplayer: run the program as instructed by these tests  It is a research tool…  It requires ANT to be executed

34 Guitar (1) Four main components: (1) GUIRipper: GUI information extraction >ant -Dproperties=jfcripper.properties -f jfcripper.xml (2) GUIStructure2Graph : Event-flow graph inference >ant -v -f GUIStructure2GraphConvert.xml

35 (3) TestCaseGenerator : Test cases generation traversing the graph >ant -v -f TestCaseGenerator.xml (4) GUIReplayer : Run the program GUI according to the generated test cases >ant -Dproperties=jfcreplayer.properties -f jfcreplayer.xml Guitar (2)

36 HtmlUnit, HttpUnit, JWebUnit HtmlFixture Selenium …. Tools for other GUI-based testing of Java

37 XUnit Web tools HtmlUnit, HTTPUnit, JWebUnit, etc. - They are inspired by JUnit - They let us to verify the functionalities of Web sites - They emulate the relevant portions of browser behavior form submission, JavaScript, http authentication, cookies, automatic page redirection, etc. - They allow Java test code to examine returned pages in terms of text, DOM, or containers of forms, tables, and links - They make it easy to write Junit tests that verify HTTP requests and responses

38 … HttpUnit example import junit.framework.TestCase; import com.meterware.httpunit.WebResponse; import com.meterware.httpunit.WebConversation; import com.meterware.httpunit.WebForm; import com.meterware.httpunit.WebRequest; public class SearchExample extends TestCase { public void testSearch() throws Exception { WebConversation wc = new WebConversation(); WebResponse resp = wc.getResponse(" WebForm form = resp.getForms()[0]; form.setParameter("q", "HttpUnit"); WebRequest req = form.getRequest("btnG"); resp = wc.getResponse(req); assertNotNull(resp.getLinkWith("HttpUnit")); resp = resp.getLinkWith("HttpUnit").click(); assertEquals(resp.getTitle(), "HttpUnit"); assertNotNull(resp.getLinkWith("User's Manual")); } Set the google page Fill the google form get the google response Send the request verify the response

39 HtmlFixture - It is used to exercise and test web pages. - It allows us make assertions about the structure of a page and to navigate between pages. - We can also fire java script, submit forms, "click" links, etc. - It is based on a fixture that lets us navigate to any element of the page DOM. To use this we need some knowledge about the DOM (Document Object Model).

40 … example

41 Capture and Replay for Web Selenium Selenium IDE: a Firefox add- on that will do simple record- and-playback of interactions with the browser Selenium WebDriver: a collection of language specific bindings to drive a browser -- the way it is meant to be driven.