Introduction
Often, it is good to test the UI behavior of your application as this is the front-end your customers see.
ATS is able to interact with various UI applications so it can be successfully used for UI automation testing. Different third-party libraries are used under the hood for each type of Tested Application.
Here are some of its features:
- Very intuitive public API
- Same look and feel for all supported applications
- Large list of supported applications:
- Web applications build with HTML and JavaScript. You can choose between different real system browsers (like Firefox) or a hidden browser with no visual UI (good for CI tests).
- Applications developed using Swing GUI.
- Mobile аpplications developed for Android and iOS
We call UI Engine the ATS library used for UI testing
The UI Engine is not appropriate for performance testing and the reason is that bringing up many browser instances is too heavy and this effectively makes any test results meaningless
Quick example
Here we will take a look at a simple example to see how UI Engine tests look like
// 1. initialize the browser FirefoxDriver driver = UiDriver.getFirefoxDriver( "SOME URL" ); // 2. start the browser driver.start(); // 3. get the engine to work with RealHtmlEngine engine = driver.getHtmlEngine(); // 4. specify the file describing the UI components we want to work with engine.loadMapFile( "MyUiComponents.map", "login" ); // 5. work with some UI components engine.getTextBox( "userNameTB" ).setValue( "admin" ); engine.getTextBox( "userPasswordTB" ).setValue( "admin" ); engine.getButton( "loginB" ).click(); // 6. stop the browser driver.stop();
This example basically does the following:
Initialize the browser. We specify we will be working with Firefox browser and provide the URL of our tested application
IPv6 addresses
For URLs with IPv6 addresses inside you should enclose the address in square brackets like this: http://[2001::22cc]:8080/myContext/
For Windows, you should use the reserved ipv6-literal.net domain as described here
- Start the browser
- Get a reference to the later used engine, in this example, this is a RealHtmlEngine as we will be testing an HTML/JavaScript application in a real browser (not a hidden one)
- Specify the file describing the UI components we want to work with. In our example, we suppose we have some map file which defines the UI components of interest. We also have a dedicated section in that file called "login" which contains the UI components at the login page of our application
- Work with some UI components. In our case we:
- set the value of a Text Box with our user name
- set the value of a Text Box with our user password
- click a login Button - Stop the browser
Terminology
Term |
Description |
---|---|
Driver |
It is bound to the specifics of the tested application and the way we interact with it. |
Engine |
This is the single entry point you use to get instances of UI elements. For example, you can call getLink() method so can work with a Link UI element. |
UI element |
A representation of a UI element. Each particular type has its own methods. For example you can call click() on a Link and setValue() on a TextBox . |
Utilities |
Some utility classes that allow doing specific actions. These are all specific to each tested application. |
Start the UI Engine
Once you have constructed your driver, you can start it by calling the start() method. It could do something easy to view (for example starting a real browser) or it could do nothing, but it is always good to run this method before taking any further actions.
Then you can get a reference to your Engine class and start sending commands to the tested application.
Stop the UI Engine
This is done by calling the stop() method of the used driver. It releases any resources, for example, it shuts down a browser.
Calling UI elements' methods
You get instances of the UI elements of interest using the variety get methods like:
// get an instance of a button and then work with that instance UiButton loginButton = engine.getButton( "loginB" ); loginButton.click(); // or you can use the short form when you need to run just one action on this element engine.getButton( "loginB" ).click();
Providing definition of UI elements
In order to find a UI element, you must give us some identification properties like ID, name, value etc.
Here are the details
Testing HTML/JavaScript applications
Here are the details
Testing mobile applications
Here are the details
Testing Swing applications
Here are the details
Configuring the UI Engine
On startup, the UI Engine is configured with its default values.
Here is the list with all supported configuration options - see the UI Engine configuration section.
The configuration values can be retrieved and changed using the UiEngineConfigurator class.
Utilities
UiEngineUtilities is a generic utility class, but each engine may provide its own utility classes through its getUtilsXYZ() methods.
Implementing custom UI Driver
Here you can see how to create your own UI Driver(not very likely to need it)
Back to parent page
Go to Table of Contents