Browse Source

add Testfx and first Gui Test

main
fdai7736 11 months ago
parent
commit
58756e16d6
  1. 8
      pom.xml
  2. 25
      src/test/java/de/hsfulda/onses/GuiTest.java

8
pom.xml

@ -43,6 +43,14 @@
<version>${junit.version}</version> <version>${junit.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.testfx</groupId>
<artifactId>testfx-junit5</artifactId>
<version>4.0.17</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

25
src/test/java/de/hsfulda/onses/GuiTest.java

@ -0,0 +1,25 @@
package de.hsfulda.onses;
import javafx.stage.Stage;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.testfx.api.FxAssert;
import org.testfx.framework.junit5.ApplicationTest;
import static org.junit.jupiter.api.Assertions.*;
import static org.testfx.matcher.control.LabeledMatchers.*;
public class GuiTest extends ApplicationTest {
private Stage stage;
@Override
public void start(Stage stage) throws Exception {
this.stage = stage;
new App().start(stage);
}
@Test
@DisplayName("Check Window Title")
void checkWindowsTitle() {
assertEquals("Onses - Uno", stage.getTitle());
}
}
Loading…
Cancel
Save