|
1 | 1 | # JavaFXLibrary
|
2 | 2 |
|
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. |
4 | 4 |
|
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. |
6 | 6 |
|
7 | 7 | JavaFXLibrary is tested to work with Robot Framework 3.0.2 or later.
|
8 | 8 |
|
9 |
| -You can connect to applications running on your local machine or even on a different machine. |
10 |
| - |
11 |
| - |
12 | 9 | ## Keyword documentation
|
13 | 10 | See keyword [documentation](https://eficode.github.io/JavaFXLibrary/javafxlibrary.html).
|
14 | 11 |
|
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: |
33 | 16 | ```
|
34 |
| -***Settings*** |
35 |
| -Library Remote http://localhost:8270/ WITH NAME JavaFXLibrary |
| 17 | +*** Settings *** |
| 18 | +Library JavaFXLibrary |
36 | 19 | ```
|
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: |
38 | 21 | ```
|
39 |
| -Launch Javafx Application javafxlibrary.testapps.TestClickRobot |
| 22 | +jython -J-cp javafxlibrary-<version>.jar -m robot.run tests.robot |
40 | 23 | ```
|
41 | 24 |
|
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: |
47 | 31 | ```
|
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 |
51 | 34 | ```
|
| 35 | +4. Run your tests: `robot tests.robot` |
52 | 36 |
|
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. |
54 | 39 |
|
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. |
59 | 41 |
|
60 | 42 | ## JavaFXLibrary demo
|
61 | 43 |
|
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. |
63 | 45 |
|
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` |
68 | 49 |
|
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/ |
82 | 53 | * Docker CE: https://docs.docker.com/install/
|
83 | 54 | * 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` |
85 | 63 |
|
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. |
91 | 65 |
|
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. |
0 commit comments