Welcome!

Oracle Authors: Michael Meiner, Carmen Gonzalez, Trevor Parsons, MC Brown, Pat Romanski

Related Topics: Java, Weblogic, AJAX & REA, Oracle, HP

Java: Article

An Introduction to Abbot

A Friendly JUnit Extension for GUI Testing

Graphical user interface (GUI) testing is a potentially problematic area because constructing effective test cases is more difficult than the corresponding application logic. The roadblocks to effective functional GUI testing are:

  • Traditional test coverage criteria like "80% coverage of the lines of code" may not be sufficient to trap all the user interaction scenarios.
  • End users often use a different user task interaction model than the one conceived by the development team.

    Functional GUI testing needs to deal with GUI events as well as the effects of the underlying application logic that results in changes to the data and presentation.

    The common methods for functional GUI testing are the "record and execute" script technique and writing test programs for different scenarios. In the "record and execute," the test designer interacts with the GUI and all the events are recorded in a script. The script can later be replayed to re-create user interactions for a particular scenario. In the test programs, the test designer tries to understand and write tests for the various GUI decision points.

    This article discusses how Abbot can be used to quickly and effectively come up with a comprehensive GUI test framework for Swing GUI applications. Abbot (http://abbot.sourceforge.net/) is a JUnit extension for Swing GUI testing. It provides an interesting framework that can be used for test case generation as well as "record and execute" scripting.

    Introduction to Abbot
    Abbot builds upon the java.awt.Robot class to provide an automated event generation and validation framework for Swing GUI components. The framework can be used to create, record, and execute scripts and programmatic test cases in Java. Abbot also has a script editor called Costello that facilitates the creation of scripts in XML. The framework can also be well integrated to run with JUnit.

    To illustrate the use of Abbot to create a GUI test infrastructure, this article will make use of the following two scenarios.

    1.   GUI already exists: The GUI has been coded and the application needs to be tested, but no unit tests are available. This scenario will primarily make use of the "record and execute" style and then focus on how test suites can be created and run with JUnit.

    2.   GUI has not been coded: The GUI has been designed on paper; however, no working code exists. This scenario will primarily focus on creating test cases in Java. This method will create a homogeneous suite of tests both for the back-end application code and the GUI.

    The two scenarios focus on the end-point cases in functional GUI testing. The principles mentioned can be mixed and matched to suit the needs of the project. To get started with Abbot, download the JAR files and place them in the lib directory of the project.

    Scenario One: GUI Already Exists
    In this scenario, most of the GUI has already been coded. Automated testing is not available and the testing is mainly being done by hand. The goal is to come up with a test suite in the shortest time possible so that the quality metrics for the project can be met effectively.

    The script editor Costello will be used to develop a battery of tests. Costello provides the "record and execute" functionality that will allow us to record different user interaction scenarios with the GUI and test those scenarios efficiently. The scripts that record the user interactions are saved as XML. The salient features of the scripts that help in rapidly creating a functional test framework are:

  • Focuses on test creation: The XML-based scripts can be written rapidly (directly or by using Costello) and are dynamically interpreted by Abbot. There's no need to write new code and compile test cases.
  • Focuses on validating GUI decision points: Abbot allows the test creators to add assertions to check for values resulting from user interactions. The assert tag is used to check for valid results from a user interaction before the script proceeds. This feature is very useful, as it helps pinpoint the step in which the GUI fails and aids in regression testing.
  • Provides infrastructure to create robust scripts: Some GUI "record and execute" tools produce very fragile scripts. These tools not only store the events but also the GUI component position information, such as coordinates, to identify them. These scripts are very fragile because any change in positional attributes (changes in layout or running the script on a different platform) breaks the scripts. Abbot uses a number of attributes to dynamically identify the component without depending on any positional attributes. These attributes in aggregate form a component reference, which can be used within the script even before the component itself necessarily exists.
  • Provides a high-level abstraction over the Java Robot class: Abbot builds on top of the Java Robot class by providing a layer of abstraction. The abstraction layer allows end users to create test cases that can capture high-level semantics like the OK button, Select CO from the list of states, etc. This makes the scripts easy to understand and enhances them in the future.

    An example of a test script in XML is provided in Listing 1.

    With this background about the features of the script, it's time to look into how to use the script editor to create the test cases. The sample GUI shown in Figure 1 is an example from the Java Swing tutorial available at java.sun.com.

    The GUI is a Celsius-to-Fahrenheit converter that takes in a numeric value and on the button click displays the converted result in Fahrenheit. To test this GUI, we can write some simple GUI tests to verify the results on the input of a positive number, a negative number, and a nonnumeric input.

  • More Stories By Satadip Dutta

    Satadip Dutta is a software architect at Hewlett-Packard (http://devresource.hp.com) and has been programming in Java since 1997. His areas of interest include distributed software architecture, Web services, and user interface design. Satadip holds an MS in Computer Science from Virginia Tech.

    Comments (7) View Comments

    Share your thoughts on this story.

    Add your comment
    You must be signed in to add a comment. Sign-in | Register

    In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


    Most Recent Comments
    Ashwath 01/18/05 02:34:16 AM EST

    I tried to run the code that u haven for 'GUI already exista' scenario. But it doen't work.. give me some eg.s

    tlroche 08/22/03 10:05:14 PM EDT

    "Abbot for SWT" (project name=abbotforswt) is an Eclipse plugin
    which seeks to extend Abbot ... for SWT (but you guessed :-) It is
    currently available only from the IIOSB (a "walled garden" version of
    SourceForge inaccessible outside IBM) @

    https://w3.opensource.ibm.com/projects/abbotforswt/

    (IIOSB residence is intended to be temporary. We are currently in IBM
    Open Source Steering Committee pre-review, and therefore hope to
    contribute our extensions back to Abbot sometime this millenium :-)
    For more detail, including

    * how abbotforswt extends j.a.Robot and Abbot

    * abbotforswt vs blackbox tools (e.g. RobotJ/XDE Tester)

    * related Eclipse 3.0 plan items

    see the (currently rather crude) abbotforswt homepage

    To demonstrate abbotforswt's feasibility, we have taken scenario 2
    from the JDJ article above, recoded its SUT (a dialog) in SWT, and
    designed and implemented an API targeting SWT equivalent to Abbot's
    existing API targeting AWT/Swing. For more details, see our release
    notes.

    Sound interesting? Try it out! However, first:

    <required type="legalese">

    If you are an IBMer and have NOT already completed your "OSPG
    training," please read the Open Source Participation Guidelines
    before you check out any code.

    </required>

    You have 2 installation options. Instructions are for Eclipse/
    WebSphere Studio users:

    0 Install the release zip. Goto our release page

    read the "IMPORTANT NOTICE", then follow the instructions in the
    release notes

    Note that you need not register for IIOSB to get the release, but we
    hope you will, because you're a fine human being. (Apologies for
    speciesism to all the fine non-human programmers out there :-)

    1 Install from CVS. This is a good first step toward becoming an
    abbotforswt contributor!

    - Run your development workbench (devbench) with either Target
    Platform pointing to a WSAD build (which is how I tested), or just
    import org.apache.xerces (should work, but not tested).

    - Create a new CVS repository location with

    host=cvs.opensource.ibm.com
    repository path=/cvs/abbotforswt
    user=anonymous
    no password
    connection type=pserver

    and check out HEAD/abbotforswt.

    - Browse to our release notes

    search or scroll to "run the demo"

    - Skip to step 4

    The demo can then be run in each of 3 ways, all of which are
    documented in the release notes:

    * using Test Collector in a launched WebSphere Studio build

    * using pde.junit to launch an Eclipse or WS build

    * using Eclipse's JUnit to launch just the UI

    tlroche 08/22/03 09:55:08 PM EDT

    "Abbot for SWT" (project name=abbotforswt) is an Eclipse plugin which seeks to extend Abbot ... for SWT (but you guessed :-) It is currently available only from the IIOSB (a "walled garden" version of SourceForge inaccessible outside IBM) @

    https://w3.opensource.ibm.com/projects/abbotforswt/

    (IIOSB residence is intended to be temporary. We are currently in IBM Open Source Steering Committee pre-review, and therefore hope to contribute our extensions back to Abbot sometime this millenium :-) For more detail, including

    * how abbotforswt extends j.a.Robot and Abbot

    * abbotforswt vs blackbox tools (e.g. RobotJ/XDE Tester)

    * related Eclipse 3.0 plan items

    see the (currently rather crude) abbotforswt homepage

    http://w3.opensource.ibm.com/~abbotforswt/

    To demonstrate abbotforswt's feasibility, we have taken scenario 2 from the JDJ article above, recoded its SUT (a dialog) in SWT, and designed and implemented an API targeting SWT equivalent to Abbot's existing API targeting AWT/Swing. For more details, see our release notes @

    http://w3.opensource.ibm.com/project/shownotes.php?release_id=597

    Sound interesting? Try it out! However, first:

    If you are an IBMer and have NOT already completed your "OSPG training," please read the Open Source Participation Guidelines

    http://ltc.linux.ibm.com/open_source/ospg.html

    before you check out any code.

    You have 2 installation options. Instructions are for Eclipse/ WebSphere Studio users:

    0 Install the release zip. Goto our release page

    http://w3.opensource.ibm.com/project/showfiles.php?group_id=1023

    read the "IMPORTANT NOTICE", then follow the instructions in the release notes

    http://w3.opensource.ibm.com/project/shownotes.php?release_id=597

    Note that you need not register for IIOSB to get the release, but we hope you will, because you're a fine human being. (Apologies for speciesism to all the fine non-human programmers

    http://www.newtechusa.com/PPI/pressroom.asp#higher

    out there :-)

    1 Install from CVS. This is a good first step toward becoming an abbotforswt contributor!

    - Run your development workbench (devbench) with either Target Platform pointing to a WSAD build (which is how I tested), or just import org.apache.xerces (should work, but not tested).

    - Create a new CVS repository location with

    host=cvs.opensource.ibm.com
    repository path=/cvs/abbotforswt
    user=anonymous
    no password
    connection type=pserver

    and check out HEAD/abbotforswt.

    - Browse to our release notes

    http://w3.opensource.ibm.com/project/shownotes.php?release_id=597

    search or scroll to "run the demo"

    - Skip to step 4

    The demo can then be run in each of 3 ways, all of which are documented in the release notes:

    * using Test Collector in a launched WebSphere Studio build

    * using pde.junit to launch an Eclipse or WS build

    * using Eclipse's JUnit to launch just the UI

    tlroche 08/22/03 09:51:39 PM EDT

    "Abbot for SWT" (project name=abbotforswt) is an Eclipse plugin which seeks to extend Abbot ... for SWT (but you guessed :-) It is currently available only from the IIOSB (a "walled garden" version of SourceForge inaccessible outside IBM) @

    https://w3.opensource.ibm.com/projects/abbotforswt/

    (IIOSB residence is intended to be temporary. We are currently in IBM Open Source Steering Committee pre-review, and therefore hope to contribute our extensions back to Abbot sometime this millenium :-) For more detail, including

    * how abbotforswt extends j.a.Robot and Abbot

    * abbotforswt vs blackbox tools (e.g. RobotJ/XDE Tester)

    * related Eclipse 3.0 plan items

    see the (currently rather crude) abbotforswt homepage

    http://w3.opensource.ibm.com/~abbotforswt/

    To demonstrate abbotforswt's feasibility, we have taken scenario 2 from the JDJ article above, recoded its SUT (a dialog) in SWT, and designed and implemented an API targeting SWT equivalent to Abbot's existing API targeting AWT/Swing. For more details, see our release notes @

    http://w3.opensource.ibm.com/project/shownotes.php?release_id=597

    Sound interesting? Try it out! However, first:

    If you are an IBMer and have NOT already completed your "OSPG training," please read the Open Source Participation Guidelines

    http://ltc.linux.ibm.com/open_source/ospg.html

    before you check out any code.

    You have 2 installation options. Instructions are for Eclipse/ WebSphere Studio users:

    0 Install the release zip. Goto our release page

    http://w3.opensource.ibm.com/project/showfiles.php?group_id=1023

    read the "IMPORTANT NOTICE", then follow the instructions in the release notes

    http://w3.opensource.ibm.com/project/shownotes.php?release_id=597

    Note that you need not register for IIOSB to get the release, but we hope you will, because you're a fine human being. (Apologies for speciesism to all the fine non-human programmers

    http://www.newtechusa.com/PPI/pressroom.asp#higher

    out there :-)

    1 Install from CVS. This is a good first step toward becoming an abbotforswt contributor!

    - Run your development workbench (devbench) with either Target Platform pointing to a WSAD build (which is how I tested), or just import org.apache.xerces (should work, but not tested).

    - Create a new CVS repository location with

    host=cvs.opensource.ibm.com
    repository path=/cvs/abbotforswt
    user=anonymous
    no password
    connection type=pserver

    and check out HEAD/abbotforswt.

    - Browse to our release notes

    http://w3.opensource.ibm.com/project/shownotes.php?release_id=597

    search or scroll to "run the demo"

    - Skip to step 4

    The demo can then be run in each of 3 ways, all of which are documented in the release notes:

    * using Test Collector in a launched WebSphere Studio build

    * using pde.junit to launch an Eclipse or WS build

    * using Eclipse's JUnit to launch just the UI

    Jeff 04/29/03 08:26:00 PM EDT

    I believe this is a forum in which comments need to be made about the article and its vaildity.

    The above messages should be in English and any concerns/comments should be made available for the benefit for all in the community

    Bhojohori Manna 04/29/03 06:00:00 AM EDT

    Chee chee, Ei rokom gala gali dile hobe.Dada koto bhalo article likheche.

    Utgandu 04/29/03 05:54:00 AM EDT

    Dada,ei jinis poisa diye keu porbe bhebechen apni?USa te theke apnio sobar moto boka patha hoye gechen .Apni ei jinista kotha theke chotha korechen?Ar apni ki GUI Master ke chenen???jobab chai,jobab dao.

    @ThingsExpo Stories
    SYS-CON Events announced today that Windstream, a leading provider of advanced network and cloud communications, has been named “Silver Sponsor” of SYS-CON's 16th International Cloud Expo®, which will take place on June 9–11, 2015, at the Javits Center in New York, NY. Windstream (Nasdaq: WIN), a FORTUNE 500 and S&P 500 company, is a leading provider of advanced network communications, including cloud computing and managed services, to businesses nationwide. The company also offers broadband, phone and digital TV services to consumers primarily in rural areas.
    "There is a natural synchronization between the business models, the IoT is there to support ,” explained Brendan O'Brien, Co-founder and Chief Architect of Aria Systems, in this SYS-CON.tv interview at the 15th International Cloud Expo®, held Nov 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.
    The major cloud platforms defy a simple, side-by-side analysis. Each of the major IaaS public-cloud platforms offers their own unique strengths and functionality. Options for on-site private cloud are diverse as well, and must be designed and deployed while taking existing legacy architecture and infrastructure into account. Then the reality is that most enterprises are embarking on a hybrid cloud strategy and programs. In this Power Panel at 15th Cloud Expo (http://www.CloudComputingExpo.com), moderated by Ashar Baig, Research Director, Cloud, at Gigaom Research, Nate Gordon, Director of T...
    The definition of IoT is not new, in fact it’s been around for over a decade. What has changed is the public's awareness that the technology we use on a daily basis has caught up on the vision of an always on, always connected world. If you look into the details of what comprises the IoT, you’ll see that it includes everything from cloud computing, Big Data analytics, “Things,” Web communication, applications, network, storage, etc. It is essentially including everything connected online from hardware to software, or as we like to say, it’s an Internet of many different things. The difference ...
    Cloud Expo 2014 TV commercials will feature @ThingsExpo, which was launched in June, 2014 at New York City's Javits Center as the largest 'Internet of Things' event in the world.
    An entirely new security model is needed for the Internet of Things, or is it? Can we save some old and tested controls for this new and different environment? In his session at @ThingsExpo, New York's at the Javits Center, Davi Ottenheimer, EMC Senior Director of Trust, reviewed hands-on lessons with IoT devices and reveal a new risk balance you might not expect. Davi Ottenheimer, EMC Senior Director of Trust, has more than nineteen years' experience managing global security operations and assessments, including a decade of leading incident response and digital forensics. He is co-author of t...

    ARMONK, N.Y., Nov. 20, 2014 /PRNewswire/ --  IBM (NYSE: IBM) today announced that it is bringing a greater level of control, security and flexibility to cloud-based application development and delivery with a single-tenant version of Bluemix, IBM's platform-as-a-service. The new platform enables developers to build ap...

    Explosive growth in connected devices. Enormous amounts of data for collection and analysis. Critical use of data for split-second decision making and actionable information. All three are factors in making the Internet of Things a reality. Yet, any one factor would have an IT organization pondering its infrastructure strategy. How should your organization enhance its IT framework to enable an Internet of Things implementation? In his session at Internet of @ThingsExpo, James Kirkland, Chief Architect for the Internet of Things and Intelligent Systems at Red Hat, described how to revolutioniz...
    The security devil is always in the details of the attack: the ones you've endured, the ones you prepare yourself to fend off, and the ones that, you fear, will catch you completely unaware and defenseless. The Internet of Things (IoT) is nothing if not an endless proliferation of details. It's the vision of a world in which continuous Internet connectivity and addressability is embedded into a growing range of human artifacts, into the natural world, and even into our smartphones, appliances, and physical persons. In the IoT vision, every new "thing" - sensor, actuator, data source, data con...
    Technology is enabling a new approach to collecting and using data. This approach, commonly referred to as the "Internet of Things" (IoT), enables businesses to use real-time data from all sorts of things including machines, devices and sensors to make better decisions, improve customer service, and lower the risk in the creation of new revenue opportunities. In his General Session at Internet of @ThingsExpo, Dave Wagstaff, Vice President and Chief Architect at BSQUARE Corporation, discuss the real benefits to focus on, how to understand the requirements of a successful solution, the flow of ...
    "BSQUARE is in the business of selling software solutions for smart connected devices. It's obvious that IoT has moved from being a technology to being a fundamental part of business, and in the last 18 months people have said let's figure out how to do it and let's put some focus on it, " explained Dave Wagstaff, VP & Chief Architect, at BSQUARE Corporation, in this SYS-CON.tv interview at @ThingsExpo, held Nov 4-6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.
    Focused on this fast-growing market’s needs, Vitesse Semiconductor Corporation (Nasdaq: VTSS), a leading provider of IC solutions to advance "Ethernet Everywhere" in Carrier, Enterprise and Internet of Things (IoT) networks, introduced its IStaX™ software (VSC6815SDK), a robust protocol stack to simplify deployment and management of Industrial-IoT network applications such as Industrial Ethernet switching, surveillance, video distribution, LCD signage, intelligent sensors, and metering equipment. Leveraging technologies proven in the Carrier and Enterprise markets, IStaX is designed to work ac...
    C-Labs LLC, a leading provider of remote and mobile access for the Internet of Things (IoT), announced the appointment of John Traynor to the position of chief operating officer. Previously a strategic advisor to the firm, Mr. Traynor will now oversee sales, marketing, finance, and operations. Mr. Traynor is based out of the C-Labs office in Redmond, Washington. He reports to Chris Muench, Chief Executive Officer. Mr. Traynor brings valuable business leadership and technology industry expertise to C-Labs. With over 30 years' experience in the high-tech sector, John Traynor has held numerous...
    Bit6 today issued a challenge to the technology community implementing Web Real Time Communication (WebRTC). To leap beyond WebRTC’s significant limitations and fully leverage its underlying value to accelerate innovation, application developers need to consider the entire communications ecosystem.
    The 3rd International @ThingsExpo, co-located with the 16th International Cloud Expo - to be held June 9-11, 2015, at the Javits Center in New York City, NY - announces that it is now accepting Keynote Proposals. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devices - computers, smartphones, tablets, and sensors - connected to the Internet by 2020. This number will continue to grow at a rapid pace for the next several decades.
    The Internet of Things is not new. Historically, smart businesses have used its basic concept of leveraging data to drive better decision making and have capitalized on those insights to realize additional revenue opportunities. So, what has changed to make the Internet of Things one of the hottest topics in tech? In his session at @ThingsExpo, Chris Gray, Director, Embedded and Internet of Things, discussed the underlying factors that are driving the economics of intelligent systems. Discover how hardware commoditization, the ubiquitous nature of connectivity, and the emergence of Big Data a...
    Almost everyone sees the potential of Internet of Things but how can businesses truly unlock that potential. The key will be in the ability to discover business insight in the midst of an ocean of Big Data generated from billions of embedded devices via Systems of Discover. Businesses will also need to ensure that they can sustain that insight by leveraging the cloud for global reach, scale and elasticity.
    SYS-CON Events announced today that IDenticard will exhibit at SYS-CON's 16th International Cloud Expo®, which will take place on June 9-11, 2015, at the Javits Center in New York City, NY. IDenticard™ is the security division of Brady Corp (NYSE: BRC), a $1.5 billion manufacturer of identification products. We have small-company values with the strength and stability of a major corporation. IDenticard offers local sales, support and service to our customers across the United States and Canada. Our partner network encompasses some 300 of the world's leading systems integrators and security s...
    IoT is still a vague buzzword for many people. In his session at @ThingsExpo, Mike Kavis, Vice President & Principal Cloud Architect at Cloud Technology Partners, discussed the business value of IoT that goes far beyond the general public's perception that IoT is all about wearables and home consumer services. He also discussed how IoT is perceived by investors and how venture capitalist access this space. Other topics discussed were barriers to success, what is new, what is old, and what the future may hold. Mike Kavis is Vice President & Principal Cloud Architect at Cloud Technology Pa...
    Cloud Expo 2014 TV commercials will feature @ThingsExpo, which was launched in June, 2014 at New York City's Javits Center as the largest 'Internet of Things' event in the world. The next @ThingsExpo will take place November 4-6, 2014, at the Santa Clara Convention Center, in Santa Clara, California. Since its launch in 2008, Cloud Expo TV commercials have been aired and CNBC, Fox News Network, and Bloomberg TV. Please enjoy our 2014 commercial.