mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-03-28 14:56:28 +01:00
Document using DISPLAY when running UI tests
This commit is contained in:
parent
5c1f041c6d
commit
afabfd9cc6
2 changed files with 28 additions and 0 deletions
28
TESTING.md
28
TESTING.md
|
@ -89,3 +89,31 @@ To take advantage of new features, such as excluding flaky and slow tests, indiv
|
|||
- refactor complicated uses of TestSuites in JUnit3 that were workarounds for the lack of JUnit features like `@BeforeAll` and `@AfterAll`.
|
||||
- add `@Test` annotation (make sure to use `org.junit.jupiter.api.Test` and not JUnit4's `org.junit.Test`)
|
||||
- statically import assert methods from `org.junit.jupiter.api.Assertions` (note that in JUnit5 the message is now last instead of first, this generally leads to an error by changing the imports, except in the case of `assertEquals` where the first and third parameter are `String`)
|
||||
|
||||
## Running GUI tests in the background (Linux only)
|
||||
|
||||
When running tests that have a UI the test runs can interfere with using your computer.
|
||||
To avoid this, a dedicated `DISPLAY` can be used by the tests to run them in a way that does not interfere.
|
||||
Using Xvfb we can create an in memory only X-Server, this is what the test machines do.
|
||||
|
||||
One time set-up:
|
||||
|
||||
```sh
|
||||
sudo apt install xvfb # or see your distribution for install instructions
|
||||
```
|
||||
|
||||
Create the X-Server on `99`:
|
||||
|
||||
```sh
|
||||
Xvfb -ac :99 -screen 0 1280x1024x24 &
|
||||
```
|
||||
|
||||
Then when running tests, use `DISPLAY=:99` as a prefix to the command, like this:
|
||||
|
||||
```sh
|
||||
DISPLAY=:99 mvn verify
|
||||
```
|
||||
|
||||
or specify the `DISPLAY` in the Eclipse JUnit launch configuration:
|
||||
|
||||

|
||||
|
|
BIN
images/junit_env_display.png
Normal file
BIN
images/junit_env_display.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 91 KiB |
Loading…
Add table
Reference in a new issue