A Test Automation Tool For Java Applets

Download Report

Transcript A Test Automation Tool For Java Applets

A Test Automation Tool For
Java Applets
By Matthew Xuereb




Testing of Web Applications
TATJA
Program Demonstration
Conclusions
1
Testing of Web Applications

3 main areas of testing:




Content Testing
Security Testing
Functional Testing
Each area has testing tools tailor made for it.
Testing of Web Applications [1/7]
2
Content Testing

Testing of the visible part of the web site

Testing Tools:

W3C Consortium Free Online Tools:




Markup Validator
Link Checker
CSS Validator
…and more
Testing of Web Applications [2/7]
3
Security Testing

Testing for security threats within the web
application

Testing tools:


OWASP open source testing tools
Commercial tools:



Acunetix
SecurityInnovation
SpyDynamics
Testing of Web Applications [3/7]
4
Functional Testing

Testing of the business logic of the web
application

Testing tools:

Open source tools:



Selenium
MaxQ
Commercial tools:


iMacros
WAPT
Testing of Web Applications [4/7]
5
Selenium

Pros:




Executes directly in Web Browser
Platform & Browser independent
Supports a wide range of programming languages
Cons :

Not capable of testing Java Applets
Testing of Web Applications [5/7]
6
Testing of Java Applets

Tools Available:

Conventional Java GUI testing tools



Are not a web application testing tool
Treats a Java Applet as a conventional GUI application
iMacros



Makes use of image recognition technology to capture
and playback events
Can be used to test different types of media files (Flash,
Shockwave, ActiveX, …) – not Java Applet specific
It is a commercial tool ($ 699.00 per license)
Testing of Web Applications [6/7]
7
Conclusion (Testing of Web Applications)



There are tools to test the different areas of
Web Applications
However there isn’t a tool tailor made
specifically to test Java Applets
The aim of this FYP is to develop a test
automation tool for Java Applets - TATJA
Testing of Web Applications [7/7]
8
TATJA






A browser and platform independent tool to
test Java Applets
Applets are tested in their actual running
environment
A record/playback testing tool
Supports regression testing
Does not makes used of any other third party
scripting languages
Is a flexible tool
TATJA [1/12]
9
TATJA Overview[1/3]

Activity Diagram:
Record Test Cases
Software Wrapping
Load Applet in
TATJA
Playback Test Cases
Software Tester
Create Sest Suite
For Regression Test
Execute Regression
Test
TATJA [2/12]
10
TATJA Overview[2/3]

TATJA is in itself a Java Applet




The Applet to be tested is loaded within TATJA
TATJA wraps within it the Applet to be tested
TATJA can gain access to each component of the
Applet to be tested
TATJA can be operated in two modes


Record Mode
Playback Mode
TATJA [3/12]
11
TATJA Overview[3/3]

Flexibility


The actions that can be performed on the Applet’s
components are defined by the user through an
XML document (TatjaML)
Reason

TATJA [4/12]
To make the tool compatible with all possible Java
Swing component
12
TATJA Basic Building Blocks

User Interface
User Interface
Java Call
Component Identification Mechanism


Applet Wrapper
Recorder Handler
Applet to Test
Recorder
Handler
Playback
Handler
Regression
Test Runner
Applet to Test
Test Cases (Java Classes)

Playback Handler

Regression Test Runner

Component Identification Mechanism
TATJA [5/12]
TatjaML Definitions Document
13
TATJA in Record Mode[1/2]


The user records the test actions on the
components of the Applet to be tested
Test actions includes:




Button clicks
Text input to text fields
Mouse clicks
The test actions are converted into Java code
and stored in Java classes.

1 Test Case => 1 Java Method
TATJA [6/12]
14
TATJA in Record Mode[2/2]

Block Diagram:

When test cases are recorded, they can be
edited/enhanced by the user manually
TATJA [7/12]
15
TATJA in Playback Mode



The User loads the Java Class with the test cases
Selects the test method and executes it
Block Diagram:
TATJA [8/12]
16
Regression Tests in TATJA[1/2]



The Applet to be tested is wrapped within
another Applet
A Java method that invokes a selection of
test cases written within this Applet wrapper
An HTML document that embeds the Applet
to be tested is generated


A JavaScript call to the Java method listed in the
second bullet
By loading the generated HTML page in a
browser, the test cases are executed
automatically
TATJA [9/12]
17
Regression Tests in TATJA[2/2]

Block Diagram:
TATJA [10/12]
18
The TatjaML Document[1/2]


Has a list of all the actions that can be
performed on each component
An action can be:



A method call on the component
An event
Each action includes the information that is
needed by TATJA to dynamically perform it




TATJA [11/12]
Which method to invoke
Which event listener to create
Which event Object to pass
…and more
19
The TatjaML Document[2/2]

Snippet:
<component name="JButton">
<commands>
<isClickable params="" desc="Check if the JButton is enabled">
<return>boolean</return>
<invoke method="isEnabled">
</invoke>
</isClickable>
</commands>
<events>
<click params="" desc="Generate a click event on a JButton">
<listener>ActionListener</listener>
<invoke method="actionPerformed">
<pass_object object="ActionEvent">
<param type="java.lang.Object">^</param>
<param type="int">3</param>
<param type="java.lang.String">^getActionCommand</param>
</pass_object>
</invoke>
</click>
</events>
</component>
TATJA [12/12]
20
Program Demonstration
Program Demonstration [1/1]
21
Conclusions

TATJA was tested with existing Java Applets
of different types on different browsers

The desired functionality was obtained and
the testing tool gave the expected results

All objectives set for this project were
successfully achieved
Conclusions [1/1]
22