Skip to content

Commit 22b157b

Browse files
authored
Merge pull request #3 from ls1intum/chore/docs
`Development`: Add documentation
2 parents a3489fc + 7bc16b2 commit 22b157b

File tree

2 files changed

+124
-2
lines changed

2 files changed

+124
-2
lines changed

Readme.md

Lines changed: 120 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,121 @@
1-
# Eos
1+
# Eos – Headless JavaFX Testing Framework for Education
22

3-
Headless JavaFX Testing Framework for Education
3+
## Overview
4+
5+
**Eos** is a headless testing framework tailored for automated testing of JavaFX-based GUI applications in educational environments.
6+
It is specifically designed to work in non-graphical environments such as Continuous Integration pipelines or automated grading systems, enabling seamless dynamic GUI testing without a display server.
7+
8+
## Motivation
9+
10+
Running GUI applications typically requires a graphical environment, which poses a challenge in headless CI/CD and auto-grading pipelines.
11+
Eos addresses this by enabling headless execution and automated interaction with JavaFX applications, while also focusing on didactic feedback for students and usability for instructors.
12+
13+
## Key Objectives
14+
15+
- **Headless Execution**
16+
Run JavaFX GUI applications in non-graphical environments without requiring a desktop windowing system.
17+
18+
- **Simulated Interaction**
19+
Simulate user interactions such as mouse movement, clicks, and keyboard input to test dynamic behavior.
20+
21+
- **Window Analysis**
22+
Verify application behavior by inspecting GUI components after interaction. This includes checking for presence, visibility, and properties of UI elements.
23+
24+
- **Educational Feedback**
25+
Generate student-friendly, pedagogically helpful test output to enhance learning.
26+
27+
### Quality Requirements
28+
29+
- **Usability**
30+
The framework should offer a simple and intuitive API for instructors, allowing rapid creation of effective GUI tests.
31+
32+
- **Performance**
33+
Fast feedback is essential. Test execution time should scale proportionally with test complexity and quantity.
34+
35+
## System Architecture
36+
37+
The architecture of Eos consists of several modular components:
38+
39+
![System Architecture](system_architecture.drawio.svg "System Architecture")
40+
41+
- **SUT-GUI Application**: The student-submitted JavaFX application (System Under Test).
42+
- **Window Service**: Provides the windowing environment. In headless mode, this is implemented using Monocle instead of the default desktop OS window service.
43+
- **User Interaction Simulator**: A low-level interface to simulate user actions via the GUI framework. It provides a high-level abstraction for interacting with the GUI.
44+
- **Tests**: Instructor-authored test cases using the Simulator Service.
45+
46+
## Implementation
47+
48+
Eos is implemented using the JavaFX framework with the following components:
49+
50+
- **TestFX**: Handles GUI component interaction and state assertions.
51+
- **Monocle**: Enables headless windowing for JavaFX.
52+
- **Ares**: Ensures secure and sandboxed test execution.
53+
54+
Eos also provides an instructor-friendly API, featuring pre-built checks and assertion utilities tailored for educational use cases.
55+
56+
## Usage
57+
58+
### Example Setup
59+
60+
An example exercise is provided in the `example` directory:
61+
62+
- `Problem.md`: Contains the exercise description.
63+
- `template/`: Code template provided to students.
64+
- `solution/`: A reference implementation of the correct solution.
65+
- `tests/`: Contains pre-configured, Eos-compatible tests ready for auto-grading and CI execution.
66+
67+
Use the following Docker image in your auto-grader: `ghcr.io/ls1intum/eos:0.0.5`
68+
69+
### Manual Setup
70+
71+
We recommend using the `example` directory as a foundation for creating your own exercises.
72+
73+
If you prefer to set up your project independently, the following is a brief, non-exhaustive overview of the key configuration steps required to integrate Eos manually:
74+
75+
1. Add the dependency:
76+
77+
```groovy
78+
testImplementation 'de.tum.cit.ase:eos:0.0.5'
79+
```
80+
81+
2. Configure within the test task in `build.gradle`:
82+
```groovy
83+
systemProperty "glass.platform", "Monocle"
84+
systemProperty "monocle.platform", "Headless"
85+
systemProperty "prism.order", "sw"
86+
systemProperty "prism.text", "t2k"
87+
```
88+
89+
3. Set up **Ares** for secure execution. Refer to the [Ares documentation](https://github.com/ls1intum/Ares) for details.
90+
4. Extend your test classes with `JavaFXTest` and begin writing tests using the Eos and TestFX APIs.
91+
92+
### Writing Tests
93+
94+
Eos offers a set of utilities for common assertions and GUI structure validation. Examples include:
95+
96+
- `captureAndSaveScreenshot(String fileName)`: Saves a screenshot of the current GUI window.
97+
- `checkForCommonVBox(Node... nodes)`: Verifies recursively that the specified nodes are placed inside a common VBox.
98+
- `getNodesOfType(Class<T> type, String query)`: Retrieves all matching nodes of a specific type.
99+
- `getNodeOfType(Class<T> type, String query)`: Retrieves a single matching node or fails the test if zero or multiple matches are found.
100+
101+
Additionally, the [TestFX API](https://testfx.github.io/TestFX/docs/javadoc/) can be used for interactions and more assertions.
102+
103+
### Running Tests
104+
105+
To run tests locally: `./gradlew clean test`
106+
107+
To simulate user interaction with visible UI (non-headless, for local verification): `./gradlew clean testLocally`
108+
109+
### OS-Specific Configuration
110+
111+
For security reasons, only whitelisted paths are allowed to be accessed during test execution.
112+
Depending on the operating system setup, you might have to configure the whitelist paths differently.
113+
Alternatively, the reproducible docker-based execution can be used to avoid these issues.
114+
115+
- **macOS**: Use the `@TestFXMacAnnotations` annotation provided by Eos to apply necessary `@WhitelistPath` annotation from Ares.
116+
- **Linux/Windows**: Configure custom paths using the `@WhitelistPath` annotation from Ares.
117+
118+
> ⚠️ Remember to remove or comment out OS-specific annotations before pushing to your remote repository. CI pipelines should only run with the minimal required permissions.
119+
120+
#### Docker-Based Execution
121+
For consistent and reproducible test execution, you can run tests using Docker: `docker run -it --rm -v ./:/app -w /app ghcr.io/ls1intum/eos:0.0.5 ./gradlew clean test`

system_architecture.drawio.svg

Lines changed: 4 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)