Current trends in Software testing leads us towards learning the tools
that would be the right candidate for doing any particular task, just like
finding the right hire from the interview. This task can be anything from
taking a screenshot or screen capture video, or creating a presentation or
testing a website in multiple browsers or automating a small windows based
installer. There are so many tools available in the market for testing, but
difficult task for me recently was trying to find the right tool to automate an
application created using Java Swing.
Swing is a
set of program components for Java programmers that provide the ability to
create graphical user interface ( GUI ) components, such as
buttons and scroll bars, that are independent of the windowing system for
specific operating system .While Swing is helpful in creating GUI faster, it
provides a challenging ground for recognizing objects to automate them for
testing.
What better way to find answer to any question other than saying "OK Google". After searching for hours on google and having top 3 choices for automating Swing UI, as per all recommendations.
- JuBula
- AssertJ and
- Sikuli
The
following are the required properties for the tool,
1. should be able to start
scripting right away (May be an IDE)
2. should be easily integrated
with Jenkins and Selenium.
3. should be maintainable and
not require separate install process
4. should be able to test
record and playback
5. should be easier to use for
testers with any level of coding knowledge
SIKULI
Sikuli
is an excellent tool to automate any application as long as you can overlook
the only negative of saving the objects as images to the drive or cloud. This
small overhead is ok, when compared to the ease at which we can automate
any application quickly. Sikuli is free opensource tool that can be used
to automate any kind of application, be it Desktop or Web based application. We
create a folder of all objects as PNG files.
Add
the dependency to PM file
<groupId>org.sikuli</groupId?
|
<artifactId>sikuli-api.standalone</artifactId>
|
<version>1.2.0-SNAPSHOT</version>
|
<packaging>jar</packaging>
|
Then
create an automation script using Selenium or any other tool or IDE you are
using. Sikuli also provides a Sikuli IDE, which can be used to create scripts
right away to test compatibility. We can use the pattern and the screen class
to access the objects and perform actions,
Screen
screen = new Screen();
Pattern image = new Pattern("C:\\searchButton.png");
screen.wait(image, 10);
screen.click(image);
JUBULA
Jubula
is an eclipse project, for automated functional testing. This tool is easier to
use with its own Graphical user interface and can be useful in automating
desktop components. Jubula has a workspace and can be easily run from Jenkins
or other CD\CI tools. The user can add events like click, type or select. They have
various components like
Textbox, Button, List and
Combo boxes. The script is created with the required component actions. Then
Application Under Test (AUT) is opened using the Jubula AUT. Map the events to
objects from AUT.
- The only problem that stopped me from using this tool is that we have manage and maintain the database and tool.
- This tool need to be maintained, in spite of managing the automation com.
- It is difficult to integrate with Jenkins.
AssertJ
AssertJ
core is a Java library that provides a fluent interface for writing assertions.
Its main goal is to improve test code readability and make maintenance of tests
easier.
- Does not have any ease of use
- Does not have any IDE and takes time to learn.
- AssertJ is used more for Unit testing than front end UI automation
- This library need to access the Java class of the application to recognize objects