Altran developed and open sourced a test library for Robot Framework to enable to create automated test scripts to test Java FX applications using the TestFX framework.
Our library is based in TestFX a simple and clean testing framework for JavaFX with fluent and clean API that uses Junit.
The goal of the TestFX Library, is to wrap the main features of TestFX in a Robot Framework library that could be easy to use.
The library was created in Java (using Robot Framework Javalib Core). This makes that the RF scripts must be runned with Jython instead of Python.
- Install Robot Framework
- Install Jython
- Download TestFXLibrary.jar
- Add the JavaFX application under test and TestFXLibrary.jar to the classpath
- Create a Robot Framework script
- Run the test with Jybot!
The library JAR can be downloaded in releases.
In order to execute the library and the application in Robot Framework, you need to add both application under test and TestFX library jars to CLASSPATH. See here how to do it.
Import TestFxLibrary in Robot Framework:
*** Settings ***
Library TestFXLibrary
*** Settings ***
Library TestFXLibrary
*** My Test Case ***
Start Application testapp.FxApplication
Click On Component \#buttonId
Select From List View By Text \#listViewId Example Text
Close Application
TIPS:
- The parameter to Start the application is the package.JavaFXApplicationClass
- If your using an id (eg. #id) as locator you must escape the hash sign in the RF script (eg. \#id)
- Please visit this wiki page for more information on how to run the scripts
You can find the keywords documentation here
Like in TestFX you can use several types of queries to interact with JavaFX components:
# using a text query
# click on a component (eg. a button) that has the text "OK"
Click On Component OK
# using a CSS class query
# Click on a component (eg. a button) that has the class "button"
Click On Component .button
# using a CSS id query
# Click on a component (eg. a button) that has the id "okbutton"
# Don't forget to escape the hash
Click On Component \#okbutton
Please see this wiki page for more information.
For more information visit this repository Wiki.
ScenicView - It will show all the component id's, locators and properties for a JavaFX application. You can find more info about Scenic View here.
First you will need to Robot Framework and jython, for Robot Framework here and for Jython here. This will enable you to run tests using Jybot.
Then you need to make sure that the Path is configured. See here how to do it here.
This is an open source project, if you are developer you can clone this project, change the code, compile it, etc. And, of course we're realy open for contribuition. New features, additional keywords, bug reports and documentation are welcome!
The library is writen in Java and the tests for the library are writen in Robot Framework, that run against a sample JavaFX application.
Besides Robot Framework and Jython we have the following additional prerequisites:
Clone repository to your machine.
git clone https://github.com/altranpt/Robot-Framework-Test-FX-Library.git
To run unit test via Maven, you only need to execute this command in command line :
mvn test
Remember that you need to execute the command on the folder where you have the project.
If you have added any keyword on the project, you will need to add the test script on the test folder to the correct test suite.
If you want to compile the project without running the tests you must execute the command in command line:
mvn install -Dmaven.test.skip=true
If you want to run the tests in a headless environment you must to execute the command in command line:
mvn clean test -Dtestfx.robot=glass -Dglass.platform=Monocle -Dmonocle.platform=Headless -Dprism.order=j2d
Once you've configured your repository deployment information correctly deploying your project's artifact will only require invocation of the deploy phase of the build:
mvn deploy
- TestFX - The JavaFX test framework - we're using TestFX 4.0.6-alpha.
- Java 8 - Java version.
- Maven - Dependency Management
- RobotFramework - To run phyton test cases in java projects
- RobotFramework Javalib Core - Javalib Core is a common core for all Robot Framework test libraries written in Java.
- Monocle - To run the library tests in headless mode.
We suggest IntelIJ Community for code editing.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
- Altran - Altran Web Site
- João Gomes
- Sérgio Lourenço
- Diogo Ribeiro
- Pedro Costa
- Bruno Calado
- Hugo Firmino
See also the list of contributors who participated in this project.
This project was developed with the support and contribution of Sophia Genetics
This project is licensed under the MIT License - see the LICENSE.md file for details.