TATJA: A Test Automation Tool for Java Applets



Similar documents
Syllabus for CS 134 Java Programming

Extending Desktop Applications to the Web

STUDY AND ANALYSIS OF AUTOMATION TESTING TECHNIQUES

Sabre Red Apps. Developer Toolkit Overview. October 2014

25 Tips for Creating Effective Load Test Scripts using Oracle Load Testing for E-Business Suite and Fusion Applications.

Generating Automated Test Scripts for AltioLive using QF Test

Desktop, Web and Mobile Testing Tutorials

An introduction to creating JSF applications in Rational Application Developer Version 8.0

JavaScript. JavaScript: fundamentals, concepts, object model. Document Object Model. The Web Page. The window object (1/2) The document object

LAB 1. Familiarization of Rational Rose Environment And UML for small Java Application Development

MiniDraw Introducing a framework... and a few patterns

How To Understand Programming Languages And Programming Languages

Java the UML Way: Integrating Object-Oriented Design and Programming

Signatures. Advanced User s Guide. Version 2.0

Topics in Website Testing. [Reading assignment: Chapter 14, pp ]

Chapter 13 Computer Programs and Programming Languages. Discovering Computers Your Interactive Guide to the Digital World

4.2 Understand Microsoft ASP.NET Web Application Development

by Jonathan Kohl and Paul Rogers 40 BETTER SOFTWARE APRIL

1. Overview of the Java Language

zen Platform technical white paper

AUTOMATED CONFERENCE CD-ROM BUILDER AN OPEN SOURCE APPROACH Stefan Karastanev

10CS73:Web Programming

WIRIS quizzes web services Getting started with PHP and Java

How To Test In Bluej

Introducing Apache Pivot. Greg Brown, Todd Volkert 6/10/2010

Lecture 9 Chrome Extensions

Chapter 12 Programming Concepts and Languages

Taleo Enterprise. Career Section Branding Definition. Version 7.5

SOFTWARE TESTING TRAINING COURSES CONTENTS

JiST Graphical User Interface Event Viewer. Mark Fong

Slide.Show Quick Start Guide

ASP.NET: THE NEW PARADIGM FOR WEB APPLICATION DEVELOPMENT

CRM Rules! User Guide. Version Prepared October, 2012 By: David L. Carr, President, Visionary Software

Client-side Web Engineering From HTML to AJAX

FioranoMQ 9. High Availability Guide

Flash Tutorial Part I

Standard Languages for Developing Multimodal Applications

Proof of Concept. A New Data Validation Technique for Microsoft ASP.NET Web Applications. Foundstone Professional Services

Business Application Services Testing

Software Requirements Specification For Real Estate Web Site

Example. Represent this as XML

Website Development Komodo Editor and HTML Intro

Lesson Overview. Getting Started. The Internet WWW

THE BCS PROFESSIONAL EXAMINATIONS Diploma. April 2006 EXAMINERS REPORT. Systems Design

Oracle Siebel CRM 8 Developer's Handbook

The preliminary design of a wearable computer for supporting Construction Progress Monitoring

BPM Scheduling with Job Scheduler

Computing Concepts with Java Essentials

Generate Android App

Web Development. Owen Sacco. ICS2205/ICS2230 Web Intelligence

Web Testing. Main Concepts of Web Testing. Software Quality Assurance Telerik Software Academy

The Smart Forms Web Part allows you to quickly add new forms to SharePoint pages, here s how:

Application for Splunk Enterprise

DiskBoss. File & Disk Manager. Version 2.0. Dec Flexense Ltd. info@flexense.com. File Integrity Monitor

International Journal of Advanced Engineering Research and Science (IJAERS) Vol-2, Issue-11, Nov- 2015] ISSN:

Web Applications Testing

Java Application Developer Certificate Program Competencies

VIRTUAL LABORATORY: MULTI-STYLE CODE EDITOR

1. Starting the management of a subscribers list with emill

IBM Tivoli Workload Scheduler Integration Workbench V8.6.: How to customize your automation environment by creating a custom Job Type plug-in

Site Maintenance Using Dreamweaver

Voice Driven Animation System

GUI Test Automation How-To Tips

Detect and Sanitise Encoded Cross-Site Scripting and SQL Injection Attack Strings Using a Hash Map

So today we shall continue our discussion on the search engines and web crawlers. (Refer Slide Time: 01:02)

Webapps Vulnerability Report

Intro to Web Development

CS 161 Computer Security

Ad Hoc Reporting. Usage and Customization

MyOra 3.0. User Guide. SQL Tool for Oracle. Jayam Systems, LLC

UML-based Test Generation and Execution

Automatic Conversion of Desktop Applications to Java Web Technology

Lecture 5: Java Fundamentals III

Agents and Web Services

Enterprise Service Bus

Source Code Translation

II. PREVIOUS RELATED WORK

Enhancing A Software Testing Tool to Validate the Web Services

LabVIEW Internet Toolkit User Guide

4 Understanding. Web Applications IN THIS CHAPTER. 4.1 Understand Web page development. 4.2 Understand Microsoft ASP.NET Web application development

Automation of Library (Codes) Development for Content Management System (CMS)

Web attacks and security: SQL injection and cross-site scripting (XSS)

IBM Operational Decision Manager Version 8 Release 5. Getting Started with Business Rules

Java 7 Recipes. Freddy Guime. vk» (,\['«** g!p#« Carl Dea. Josh Juneau. John O'Conner

Software documentation systems

RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science

INTRODUCTION TO ATRIUM... 2 SYSTEM REQUIREMENTS... 2 TECHNICAL DETAILS... 2 LOGGING INTO ATRIUM... 3 SETTINGS... 4 NAVIGATION PANEL...

Functional UI testing of Adobe Flex RIA. Viktor Gamov August,

Java 6 'th. Concepts INTERNATIONAL STUDENT VERSION. edition

Certified Selenium Professional VS-1083

An Automated Testing Tool Using UI Structure

Technical paper review. Program visualization and explanation for novice C programmers by Matthew Heinsen Egan and Chris McDonald.

CaptainCasa. CaptainCasa Enterprise Client. CaptainCasa Enterprise Client. Feature Overview

MODULE 7: TECHNOLOGY OVERVIEW. Module Overview. Objectives

Fireworks 3 Animation and Rollovers

JAVA DEVELOPER S GUIDE TO ASPRISE SCANNING & IMAGE CAPTURE SDK

Transcription:

TATJA: A Test Automation Tool for Java Applets Matthew Xuereb 19, Sanctuary Street, San Ġwann mxue0001@um.edu.mt Abstract Although there are some very good tools to test Web Applications, such tools neglect the facility to test Java Applets. The implemented tool allows software testers to test Java Applets in their actual running environments without the need for testers to learn any proprietary scripting language. The tool is platform- and browser independent. Tests cases are generated directly in Java. 1 Introduction and Background Software testing is the process of executing a program with the target of finding errors (Myers, 2004). Software testing is performed either manually or else by using specialized automated testing tools. With the popularity of internet applications increasing rapidly, and with the users expecting more robust, functionally rich and reliable products from this phenomenon, a lot of automated testing tools were developed to test internet applications. In order to assure the quality of a web applications it is required that a number of test cases to be designed and executed automatically and repeatedly to demonstrate the required web application s capabilities and behaviors under different circumstances. There are basically three main areas of testing with regards to web applications. These are: 1. Content Testing 2. Security Testing 3. Functional Testing Content Testing has to do with testing of the visible part of the web site, including: Tests to verify that the web pages are rendered the same on various web browsers, Tests to validate documents such as HTML, CSS and SMIL, Tests to validate hyperlinks, Tests to check for accessibility, and more. Security Testing has to do with the testing for security issues within the web application, including tests for threats such as Cross Site Scripting, Injection Flaws, and more. Functional Testing has to do with the testing of the business logic (functionality) of the application. There is a large number of web application testing tools that can be used to test these three areas. The W3C 1 consortium has devised a number of free online tools to test the content of web pages. The OWASP foundation 2 is continually researching on security testing and also develops tools to tests for security threats. There are also a lot of tools that are used to test the functionality and business logic of internet applications. A number of these tools provide capture playback capabilities whilst others can only be used programmatically. Although there are a lot of such tools, Java Applets can only be tested either by using Swing/AWT testing tools or else by using tools that makes use of image recognition in order to capture and playback events. When using such tools, if modifications are made to an applet (even minimal changes made to the user interface), the tester would have to re-write the test for that applet from scratch. Currently, there are no applet testing tools that are capable of testing applets at runtime in their 1 http://www.w3.org/ 2 http://www.owasp.org/ 1

actual working environment, that is, in web browsers. 2 Aims and Objectives The main objective of this project is to overcome the restrictions of existing applet testing tools by developing a flexible test automation tool specifically to test Java Applets in their actual running environment. The tool should be platformand browser-independent so that the same test cases can be executed on different web browsers and operating systems using the same tool without any modifications required from the user. Our tool facilitates also regression testing. Test suites can be created by the test engineer. Such test suites can be executed programmatically without the need of any manual intervention from the test engineer to load the tool. 3.1 Recording Mode Figure 1 illustrates TATJA in recording mode. The Recorder Handler is in charge of everything that happens during the recording mode. In the TatjaML File there should be the commands together with all the required data that each Applet component can perform. Another aim of our system is to reduce the effort required by testers to perform tests. Thus, the system will be designed in such a way that no proprietary language will need to be learnt by the tester to use this tool and test cases can be simply written or automatically generated using normal Java code. 3 Specification and Design Our system will be implemented in the form of a Java applet, so that the applet to be tested can be wrapped and loaded within our system. The proposed system will have two modes of operation: Record and Playback. A unique identifier will be assigned by TATJA to each component within the test applet. If the system is in Record mode, the user can simply use the applet via the Graphical User Interface (GUI), to create test cases. The actions available to particular components e.g. click, check, uncheck, type, and more, are retrieved from an XML definition document (TatjaML) and the Java test case code will be automatically generated by TATJA, depending on the type of component chosen by the user. The generated code is saved into a test class containing methods (for each of the individual test cases) for the particular applet being tested. Figure 1 When the user switches TATJA to Recording Mode, the Recorder Handler would use the TatjaML document specification to retrieve the list of the actions that can be performed by the user on a particular component. The Recorder Handler should handle all the actions performed by the user and all these actions are transparently translated into compiled Java code as test cases. 3.2 Playback Mode Figure 2 illustrates TATJA in playback mode. The Applet to be tested is wrapped within our Applet testing tool. On the other hand, if the system is in Playback mode, the user can select a test class and test method to execute, and the test case is executed, using the GUI components of the applet, as if a user is actually running the test case manually. 2

Figure 2 When the user switches TATJA to Playback Mode, the Playback Handler makes use of the TatjaML document to retrieve the actions in the test classes so that can subsequently render the actions (commands) dynamically. Note that the TatjaML file to be used in playback is the same that is used during the recording mode when the test cases were are recorded by the user. The tool in Playback Mode is operated in two ways. It can be operated by executing the tool in a browser and manually selecting the test cases to be executed. This option is most likely to be used during the test cases creation phase. TAT- JA has also the option to create and execute the test suite, that is, a collection of test cases, on different web browsers programmatically. Being able to programmatically invoke TATJA and perform tests in different web browsers, makes it possible to use and integrate the tool with other Web Application testing tools such as Selenium 3. This option is most likely to be used in regression testing since the test engineer can programmatically invoke a particular web browser and execute on it a selection of test cases. Figure 3 illustrates a diagram of TATJA when it is invoked programmatically in playback mode. 3 http://selenium.openqa.org/ Figure 3 In the scenario depicted in Figure 3, the Applet to be tested is again wrapped inside another Applet. A Java method that invokes a selection of test classes (through a test suite) is generated within the Applet wrapper. This Java method is generated in order to be invoked when it is required to execute the test suite. An HTML page with the code that embeds the Applet is also generated. This HTML page also contains JavaScript code that invokes the previously generated Java method. When the HTML page is loaded in a web browser, the JavaScript code automatically invokes the Java method that contains the instructions to run the desired test cases. Thus, by simply loading the generated HTML page in a web browser, the test cases are executed automatically. 3.3 The TatjaML Document TatjaML is the name of the markup language that is going to be used by TATJA. TatjaML contains a list of all the actions that can be performed on each component. An action can be either an event or a method call (command) on the component. With each action there is included all the information that is needed by TATJA to dynamically perform that operation. A component is defined in a TatjaML document using the component tag. The parameter name of this tag identifies the Java component (For example JPanel, JButton ). A component tag consists of two other tags, commands and events. These two tags are used to define user actions 3

that can be performed either by method calls or by event generation respectively. Note that each component definition can have zero or more commands and events. 3.3.1 Commands A TATJA command is defined by creating a new tag within the commands tag. The name of this tag should be the name of the name that identifies that command. Figure 4 shows an example of a TatjaML command. A TATJA event is defined by creating a new tag within the events tag. It is much the same as the commands tag, with the parameters param and desc for the parameters and description respectively. This type of tag is made up of the tags listener and invoke. Figure 5 shows an example of a TatjaML event. Figure 5 Figure 4 A command tag has two parameters, params and desc. The parameter params is used to identify any parameter types (such as int, String ) that the particular command requires when it is called by TATJA. The other parameter, desc, is used to define a description of that command. The command tag consists of another two tags, the return tag and the invoke tag. The return tag is used to identify the return value of that command (such as null, int, String ). The invoke tag is used to identify the method that has to be invoked on that particular component. The method name is defined in the method parameter. Note that if the method requires parameters, a list of parameters is given within the invoke tag as param tags. Each param tag has a parameter type that is used to define the parameter type. The content of the param tag is the value of the parameter. If the value of the parameter is not constant but it has to be entered by the user as a command parameter, the contents of the param tag should be a name with an ampersand symbol (&) at the beginning (See Figure 4). An ampersand symbol at the beginning of that particular param tag value implies that the value of that parameter has to be mapped to a parameter that was defined in the first tag of that particular command. 3.3.2 Events The listener tag is used to identify the name of the event listener that has to be created by TAT- JA. The invoke tag has a parameter method that identifies the name of the method that has to be invoked in order to generate the event. The latter has another tag, the pass_object tag. This tag is used to identify the event object that has to be passed as a parameter to the method that is defined in the invoke tag. The pass_object tag can have zero or more param tags. The param tags are used to identify the parameters (type and value) that have to be passed to the event object in order for it to be created. The values of the param tag can be of three types. They can either be hard coded values, or values that starts with an ampersand symbol (&), or else the value can be only or starts with the carrot symbol (^). If the value starts with an ampersand symbol, then the value of that parameter has to be mapped to a parameter that was defined in the fist tag of that particular event (the same principle that is used in the command tag is used again here). If on the other hand the value is just the carrot symbol (See Figure 5), it means that that particular component has to be passed as a parameter to the event object self mapping. If the value starts with the carrot symbol, then the parameter to be passed is a method call on that particular event object with the method name being the string following by the carrot symbol. 4

3.4 Component Identification An important operation that is done by TATJA is that of uniquely identifying the different components that make up the Applet to be tested. It is important that TATJA identifies the components of a Java Applet during the play back process in the same manner that it identifies them during the recording process since inherently Java does not have a mechanism of uniquely identifying each component making up a Java Applet (or any other type of GUI). Note that a Java programmer can optionally give a name to a Swing component, however this name has not to be unique. Since it is not mandatory for a Java programmer to give a name for the GUI components, many programmers do not give names to the components. In order to uniquely identify each GUI component, a hash table is used. The value of the hash table contains a reference to the actual Applet component. The key of the hash table is a generated unique identification string. If a particular component has a name (given by the programmer during the development of the Applet), than the key of that particular component in the hash table is the name given by the programmer. If there are more than one component with the same name in the same Applet, than that name is still used as an identification key however a number is appended to it in order to make it unique. If on the other hand the Applet component does not have a name, the key of that component in the hash table is the type of that component, for example JButton with a number appended to it in order to make it unique, for example JButton5. 3.5 Component Action Recording In order to instruct TATJA to perform a particular action on a particular component, the dot notation technique is adopted. Figure 6 illustrates an example of how TATJA adopted the dot notation. Figure 6 The literal before the dot is used to identify the component on which to perform the action, while the literal after the dot is used to identify the action to be performed. Recall that the identification name of each component is stored in a hash table and all the possible actions that can be performed on each component are defined in the TatjaML document. As shown in Figure 6, an action can have zero or more parameters. Since the TATJA instructions are executed in the Java language, it is important that if there are any parameters within an action, the parameters are written according to the Java language specifications. That is, if a string is passed as a parameter it should be enclosed within double quotes ( ), if the parameter is a boolean value the values can either be true or false, and if the parameter is a number it should be written according to the Java numeric types specifications. 3.6 GUI Design When the user loads the Applet to be tested within TATJA, the user then sets the test class and test method to be used, then clicks on the Record icon to start recording. Once the user clicks on the Record button, the user is able to record actions on each of the Applet s components. When the user moves the mouse pointer on a particular component, that particular component is highlighted, and a popup dialog box is displayed on the screen with all the relevant information about that component (such as type, name ) and also with all the possible actins (together with their description) as defined in the TatjaML document that are possible to do on that component. In order to select a particular action the user clicks on the name of the desired action. If the chosen action has parameters, than another dialog box should be displayed on the screen in order to let the user to enter the required parameters. When the user records a particular action, the action is coded as part of the Java method within the Java test class. A test case (or set of test cases) can be executed manually from the tool by first loading the Applet in the tool. Then the test class and test me- 5

method is selected and executed by hitting the Play Icon. 4 Implementation The tool was implemented successfully using the Java language. A user friendly graphical user interface was developed. In order to gain access to the Applet s components and to invoke methods and events on them the Reflection API 4 was used. With reflection one can develop software engineering tools that examine and produce code. Reflection facilitates testing and problem determination by facilitating the automation of more tedious tasks. (OOPSLA 2003) 5 Testing and Results White box and black box testing were applied to TATJA. Each component of TATJA was developed and tested on its own. Integration testing then followed to test if the different modules still function correctly after being interfaced with each other. Finally system and acceptance testing is carried out to check if the system has met the specifications it was designed for and to see if the system is performing well overall. After the testing process, the tool has also been tested with existing Java applets of different types such as loan calculator, physics experiment simulator, data cluster simulator, and more. 6 Conclusions The desired functionality of the tool was obtained. The testing tool also gave the expected results for all the test cases carried out. It can thus be concluded that all objectives set for this project were successfully achieved. more definitions to the existing document, it would be of assistance to the users of TATJA if the tool would have a function to check the syntax and semantics of this important definition document. A possible research that can lead to an improvement on the tool is in the way that TATJA uniquely identifies each component of the Applet to be tested. With the current system, if someone removes and adds some components to the Applet to be tested, it might be thee case that some of the components will be constrained to change their identification name, resulting in some of the previously recorded test cases to be irrelevant. Bibliography Glenford J. Myers. The Art of Software Testing (2 nd Edition). John Wiley & Sons, 2004. Elfriede Dustin. Effective Software Testing: 50 Specific Ways To Improve Your Testing. Addison Wesley, 2002. Bill Hetzel. The Complete Guide to Software Testing (2 nd Edition). John Wily & Sons, 1998. Mauro Pizze & Michael Young. Software Testing and Analyses: Process, Principles and Techniques. John Wily & Sons, 2008. WWW. OOPSLA 2003 Java Reflection http://www.oopsla.org/oopsla2003/files/tut-27.html [Accessed: 28-05-2008] Although the tool was successfully implemented and all the objectives set for this project were successfully achieved, obviously there is room for improvement in order to make the tool more usable. Since users of TATJA can have their own custom made TatjaML document and they can also add 4 http://java.sun.com/j2se/1.4.2/docs/api/java/lang/refle ct/package-summary.html 6