Skip to content

Commit 4d533ab

Browse files
committed
Merge branch 'master' into play_with_docker
# Conflicts: # README.md
2 parents 6e28bc3 + fee292e commit 4d533ab

File tree

5 files changed

+51
-88
lines changed

5 files changed

+51
-88
lines changed

README.md

Lines changed: 39 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,66 @@
11
# JavaFXLibrary
22

3-
[Robot Framework](http://robotframework.org) library for testing and connecting to a JavaFX java process and using [TestFX](https://github.com/TestFX/TestFX).
3+
[TestFX](https://github.com/TestFX/TestFX) based [Robot Framework](http://robotframework.org) library for testing JavaFX Applications.
44

5-
This library allows you to use robot/pybot (Python version of Robot Framework) to run test cases over remote library interface although it also works if you are running with jybot (Jython version of Robot Framework). This means that you can use your other pure Python libraries in your test cases that will not work when runnin with Jython.
5+
JavaFXLibrary works with both Jython (local and remote use) and Python (remote only) versions of Robot Framework. This means JavaFXLibrary can be used with Jython incompatible test libraries too by importing it as a remote library.
66

77
JavaFXLibrary is tested to work with Robot Framework 3.0.2 or later.
88

9-
You can connect to applications running on your local machine or even on a different machine.
10-
11-
129
## Keyword documentation
1310
See keyword [documentation](https://eficode.github.io/JavaFXLibrary/javafxlibrary.html).
1411

15-
## Installation
16-
17-
1. Download latest JavaFXLibrary and documentation from https://github.com/robotframework/JavaFXLibrary/releases/
18-
2. Copy(if needed) JAR to desired location and run from command line using
19-
```
20-
java -jar javafxlibrary-<version>.jar
21-
22-
```
23-
3. JavaFXLibrary in RemoteServer mode should now be running in port [8270](http://localhost:8270)
24-
4. Optionally JAR can be launched with port number as an optional argument:
25-
```
26-
java -jar javafxlibrary-<version>.jar 1234
27-
```
28-
5. JavaFXLibrary in RemoteServer mode should now be running in port [1234](http://localhost:1234)
29-
30-
## Usage in Robot suite settings
31-
32-
Import the library:
12+
## Taking the library into use
13+
### As a local library
14+
1. Download JavaFXLibrary jar file from [releases](https://github.com/eficode/JavaFXLibrary/releases/)
15+
2. Import JavaFXLibrary in test settings:
3316
```
34-
***Settings***
35-
Library Remote http://localhost:8270/ WITH NAME JavaFXLibrary
17+
*** Settings ***
18+
Library JavaFXLibrary
3619
```
37-
Now the keywords can be used as usual:
20+
3. Add library jar to Jython [module search path](http://robotframework.org/robotframework/3.0b1/RobotFrameworkUserGuide.html#configuring-where-to-search-libraries-and-other-extensions) and run your tests:
3821
```
39-
Launch Javafx Application javafxlibrary.testapps.TestClickRobot
22+
jython -J-cp javafxlibrary-<version>.jar -m robot.run tests.robot
4023
```
4124

42-
In case of duplicate keywords(multiple keywords found with same name) use e.g. `JavaFXLibrary.'Keyword Name'` to get rid of warnings.
43-
44-
## Using multiple remote libraries
45-
46-
If you need to use the Remote library multiple times in a test suite, or just want to give it a more descriptive name, you can import it using the WITH NAME syntax.
25+
### As a remote library
26+
1. Download JavaFXLibrary jar file from [releases](https://github.com/eficode/JavaFXLibrary/releases/)
27+
2. Start JavaFXLibrary as a remote library: `java -jar javafxlibrary-<version>.jar`
28+
- Remote library starts in port [8270](http://localhost:8270) by default.
29+
- Port number can also be defined in the start command: `java -jar javafxlibrary-<version>.jar 1234`
30+
3. Import JavaFXLibrary in test settings:
4731
```
48-
***Settings***
49-
Library Remote http://localhost:8270/ WITH NAME client1
50-
Library Remote http://localhost:8272/ WITH NAME client2
32+
*** Settings ***
33+
Library Remote http://127.0.0.1:8270 WITH NAME JavaFXLibrary
5134
```
35+
4. Run your tests: `robot tests.robot`
5236

53-
Now the keywords can be used as `client1.List Windows` and `client2.List Windows`
37+
## Identifying JavaFX UI objects
38+
[Scenic View](http://fxexperience.com/scenic-view/) is a tool that allows you to inspect the JavaFX application scenegraph. This can be useful especially when you do not have access to the source code.
5439

55-
## JavaFX UI objects
56-
57-
With [Scenic View](http://fxexperience.com/scenic-view/) you can see all your JavaFX applications UI objects.
58-
See [keyword documentation](#keyword-documentation) for additional info how to use them with keywords.
40+
See [keyword documentation](https://eficode.github.io/JavaFXLibrary/javafxlibrary.html#3.%20Locating%20JavaFX%20Nodes) for detailed information about handling UI elements with the library.
5941

6042
## JavaFXLibrary demo
6143

62-
This can be also used as JavaFXLibrary demo.
44+
Library's acceptance test suite can be used as a JavaFXLibrary demo. Running the test suite requires [Maven](https://maven.apache.org) installation.
6345

64-
Generic way with Maven (in repository root):
65-
```
66-
mvn verify
67-
```
46+
### Running the demo locally
47+
- Clone the repository: `git clone https://github.com/eficode/JavaFXLibrary.git`
48+
- Run acceptance tests (in repository root): `mvn verify`
6849

69-
Windows command line:
70-
```
71-
java -cp "target\javafxlibrary-<version>.jar" org.robotframework.RobotFramework --include smoke src\test\robotframework/
72-
```
73-
74-
Linux/OSX command line:
75-
```
76-
java -cp "target/javafxlibrary-<version>.jar" org.robotframework.RobotFramework --include smoke src/test/robotframework/
77-
78-
```
79-
80-
## Remote library demo with Docker
81-
### Requirements:
50+
### Running the demo using Docker
51+
#### Requirements:
52+
* VNC viewer e.g. https://www.realvnc.com/en/connect/download/viewer/
8253
* Docker CE: https://docs.docker.com/install/
8354
* Docker-compose: https://docs.docker.com/compose/install/
84-
* Port 80 is free in your machine
55+
* VNC port: vnc://localhost:5900
56+
57+
#### Running the tests
58+
1. Build & start the Dockerized environment: `docker-compose up -d robot-framework javafxcompile`
59+
2. Take VNC connection to: <i>vnc://<docker_daemon_ip>:5900</i>
60+
3. Password is: 1234
61+
4. Open shell by right clicking in VNC desktop and selecting Applications > Shells > Bash
62+
5. Execute tests: `test.sh`
8563

86-
### Running the demo with testing env
87-
1. Build & Start Dockerized Environment: `docker-compose up -d robot-framework javafxcompile`
88-
2. Open browser to <docker_daemon_ip>
89-
3. Open xterm from start menu > System tools > xterm
90-
4. Execute tests in xterm window: `test.sh`
64+
Executing _test.sh_ runs the acceptance suite twice: first using JavaFXLibrary as a local Robot Framework library on Jython, and after that using the library in remote mode executing the same tests on python version of Robot Framework.
9165

92-
FYI:
93-
Single testcase execution in locale|remote|all (replace spaces in testcase name with _ ):<br>
94-
`test.sh locale '--include tag_name' '-t test_case_name'`<br>
95-
Single suite execution in locale and remote (replace spacesin test suite name with _ ):<br>
96-
`test.sh remote '--include tag_name' '-s suite_name'`
97-
<br>
98-
NOTE: smoke tag is default included.
66+
If you want the suite to run only once, you can define which type of library to use by including **local** or **remote** as an argument. For example command `test.sh remote` will execute the suite only in remote mode.

src/main/java/JavaFXLibrary.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public static void main(String[] args) throws Exception {
155155
JavaFXLibraryRemoteServer.configureLogging();
156156
System.out.println("-------------------- JavaFXLibrary --------------------- ");
157157
RemoteServer server = new JavaFXLibraryRemoteServer();
158-
server.putLibrary("/", new JavaFXLibrary());
158+
server.putLibrary("/RPC2", new JavaFXLibrary());
159159
int port = 8270;
160160
InetAddress ipAddr = InetAddress.getLocalHost();
161161

src/main/java/libdoc-documentation.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ This will start the remote server listening on port 1234.
3333

3434
JavaFXLibrary can be taken into use as remote library in settings table as follows:
3535
| *Settings* | *Value* |
36-
| Library | Remote | http://localhost:8270/ | WITH NAME | JavaFXLibrary |
36+
| Library | Remote | http://localhost:8270 | WITH NAME | JavaFXLibrary |
3737

3838
Multiple JavaFXLibraries in remote mode:
3939
| *Settings* | *Value* |
40-
| Library | Remote | ip_address:8270/ | WITH NAME | my_application |
41-
| Library | Remote | ip_address:8271/ | WITH NAME | my_other_application |
40+
| Library | Remote | ip_address:8270 | WITH NAME | my_application |
41+
| Library | Remote | ip_address:8271 | WITH NAME | my_other_application |
4242

4343

4444

src/test/robotframework/acceptance/ScreenCapturingTest.robot

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,14 @@ Capture Bounds
4242
${IMAGE2} Load Image ${COMPARISON}bounds.png
4343
Images Should Match ${IMAGE1} ${IMAGE2} ${99}
4444
45-
Load Image From URL
46-
[Tags] smoke
47-
${IMAGE} Load Image From Url http://i.imgur.com/A99VNbK.png
48-
${TARGET} Load Image ${COMPARISON}url.png
49-
5045
Save And Load Image With Path
51-
[Tags] smoke
52-
${NODE} Find id=rectangleContainer
53-
${IMAGE1} Capture Image ${NODE}
54-
Save Image As ${IMAGE1} ${TEMPDIR}${/}image.png
55-
Log <img src="${TEMPDIR}${/}image.png" widht="800"> html=true
56-
${IMAGE2} Load Image ${TEMPDIR}${/}image.png
57-
Images Should Match ${IMAGE1} ${IMAGE2}
46+
[Tags] smoke
47+
${NODE} Find id=rectangleContainer
48+
${IMAGE1} Capture Image ${NODE}
49+
Save Image As ${IMAGE1} ${TEMPDIR}${/}image.png
50+
Log <img src="${TEMPDIR}${/}image.png" widht="800"> html=true
51+
${IMAGE2} Load Image ${TEMPDIR}${/}image.png
52+
Images Should Match ${IMAGE1} ${IMAGE2}
5853
5954
Images Should Match
6055
[Tags] smoke
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
*** Keywords ***
22
Import JavaFXLibrary
33
Run Keyword If sys.platform.startswith('java') Import Library JavaFXLibrary
4-
... ELSE Import Library Remote http://javafxcompile:8270/ WITH NAME RemoteJavaFXLibrary
4+
... ELSE Import Library Remote http://javafxcompile:8270 WITH NAME RemoteJavaFXLibrary

0 commit comments

Comments
 (0)