Browse Source

created test for checking if Action is performed after correct Answer is pressed

master
Ozan-Can Ekinci 2 years ago
parent
commit
948a064d64
  1. 37
      src/test/java/game/loadNextQuestionTest.java
  2. 1
      target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst

37
src/test/java/game/loadNextQuestionTest.java

@ -0,0 +1,37 @@
package game;
import static org.junit.jupiter.api.Assertions.*;
import java.awt.event.ActionEvent;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestInstance.Lifecycle;
import Gui.GameGui;
import Gui.gui;
@TestInstance(Lifecycle.PER_CLASS)
class loadNextQuestionTest {
gui gui = new gui();
GameGui gameGui = new GameGui();
@BeforeAll
void setUp(){
gui.StartMainMenu();
gameGui.createGui();
}
@Test
public void testCorrectAnswer() {
//arrange
gameGui.questionNr = 0;
loadNextQuestion loadNextQuestion = new loadNextQuestion();
runGame.splitAns = new String[] {"option1", "option2", "option3", "option4", "1"};
//act
gameGui.AnswersBtn1.doClick();
//assert
assertEquals(1, gameGui.questionNr);
}
}

1
target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst

@ -1,4 +1,5 @@
C:\Users\ozan_\MiniGameProject\src\test\java\Gui\ActionHandlerTest.java
C:\Users\ozan_\MiniGameProject\src\test\java\Gui\GameGuiTest.java
C:\Users\ozan_\MiniGameProject\src\test\java\game\loadNextQuestionTest.java
C:\Users\ozan_\MiniGameProject\src\test\java\game\runGameTest.java
C:\Users\ozan_\MiniGameProject\src\test\java\Gui\guiTest.java
Loading…
Cancel
Save