Skip to content

Commit

Permalink
feat: Skip GUI-related tests when no X11 DISPLAY is set
Browse files Browse the repository at this point in the history
- Added check for DISPLAY environment variable in SwingAppWithJavaFXAndJEditorPaneTest.
- Throw SkipException to skip GUI tests if DISPLAY is not set.
- Ensures GUI tests are only run in environments with an available display.
  • Loading branch information
RalfBarkow committed Jun 6, 2024
1 parent 02b4a20 commit 6d39450
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package playground.swing;

import org.testng.SkipException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

Expand All @@ -19,6 +20,11 @@ public class SwingAppWithJavaFXAndJEditorPaneTest {

@BeforeClass
public void setUp() {

if (System.getenv("DISPLAY") == null) {
throw new SkipException("Skipping GUI tests as no DISPLAY is set");
}

// Initialize the application components
frame = new JFrame("Swing and JavaFX Application");
panel = new JPanel();
Expand Down

0 comments on commit 6d39450

Please sign in to comment.