SwingLibrary is a Swing GUI testing library for Robot Framework.
SwingLibrary uses a Netbeans tool called Jemmy as it's internal driver.
To take the library into use in the test suite, simply specify it in the settings table. E.g.
Setting Value Library SwingLibraryThe SwingLibrary.jar needs to be in the class path during execution. You can get the jar either from the download page, or as a Maven dependency:
<dependency> <groupId>org.robotframework</groupId> <artifactId>swinglibrary</artifactId> <version>1.7</version> </dependency>
In order to interact with the Swing Gui components, first a desired context must be selected by using for example Select Window or Select Dialog keyword. After that the Swing components can be located in the selected context using a desired keyword with an identifier.
Identifier can be:
Examples:
Test Add Todo Item Select Window Todo List Insert Into Text Field Todo Item buy milk Push Button Add Select From List todolist 0 ${item}= Get Selected Value From List todolist Should Be Equal ${item} buy milk
The previous test:
There are a couple of ways to find out what components there are in a given context. Keyword List Components in Context can be used in a Robot test as a debugging tool. It is also possible to use an external tool such as JSpy to inspect the component hierarchy of a Swing application.
Swing Explorer is a tool for Swing developers intended for visual exploring of a Swing-based application internals.
Download the Swing Explorer and start your SUT using its Launcher (with the swexpl.jar and swag.jar also in the class path):
java -cp swexpl.jar;swag.jar org.swingexplorer.Launcher <The SUTs Main Class>
For a quick trial, you can try testing the demo application that comes with swing library. Download the latest swinglibrary-x.x.jar, swexpl.jar, and swag.jar. Copy the jars to the same directory and execute (replacing the swing library version number with yours):
java -cp swexpl.jar;swag.jar;swinglibrary-1.9.4 org.swingexplorer.Launcher org.robotframework.swing.testapp.examplesut.TodoListApplication
The demo application and the Swing Explorer windows should appear and the exploring of Swing application can be started.
For more information, refer to the Swing Explorer documentation.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4