-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into origin/konrad_ManualTest
- Loading branch information
Showing
4 changed files
with
254 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Manuális tesztelés napló | ||
1. | ||
1. A tesztelt funkció megnevezése, leírása: | ||
1.1. Támadás: Exploratory testing útján derült ki, hogy egy játékos képes megtámadni saját magát | ||
|
||
|
||
2. Az adott funkcióhoz tartozó tesztesetek: | ||
2.1. "A" karakter megtámadja "A" karaktert fegyverrel | ||
|
||
|
||
3. Az adott teszteset elvárt kimenetele: | ||
3.1. “A” karakter meghal a támadás után. | ||
|
||
|
||
4. Az adott teszteset tényleges kimenetele: | ||
4.1. “A” karakter meghal | ||
|
||
|
||
5. Észrevételek az adott tesztesettel kapcsolatban: | ||
5.1. Maga a támadás, mint funkció működik, hiszen az elvárt kimenet, | ||
hogy a karakter akit megtámadnak egy nem kicsorbult fegyverrel, az az, hogy meghal. | ||
Azonban a funkció teljes mértékben haszontalan, és egy félrekattintás esetén a játék végét jelenti valakinek, | ||
így érdemes javítani a felhasználói élmény és ergonómia szempontjából. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -460,4 +460,8 @@ public void drawInterface() { | |
frame.add(layeredPane); | ||
} | ||
|
||
public JFrame getFrame(){ | ||
return frame; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,221 @@ | ||
package virologist.view; | ||
|
||
import virologist.control.*; | ||
import virologist.model.Game; | ||
import virologist.model.Virologist; | ||
import virologist.model.codes.BlockCode; | ||
import virologist.model.equipments.Axe; | ||
import virologist.model.equipments.Equipment; | ||
import virologist.model.map.*; | ||
|
||
import org.junit.jupiter.api.*; | ||
import org.mockito.internal.matchers.Or; | ||
import org.mockito.internal.util.reflection.GenericMaster; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.awt.Robot; | ||
import java.awt.event.InputEvent; | ||
import javax.swing.*; | ||
|
||
@TestMethodOrder (MethodOrderer.OrderAnnotation.class) | ||
public class WindowTest { | ||
|
||
private static Loader loader; | ||
private static Controller controller; | ||
|
||
private static int leftClick; | ||
|
||
private static Window window; | ||
|
||
private static Robot robot; | ||
|
||
private static final int ROBOT_DELAY = 200; | ||
|
||
@BeforeAll | ||
public static void createEnvironment(){ | ||
try{ | ||
loader = new Loader(); | ||
controller = new Controller(loader.loadGame("maps/map3.txt")); | ||
window = controller.getWindow(); | ||
window.getFrame().setLocation(0, 0); | ||
robot = new Robot(); | ||
leftClick = InputEvent.BUTTON1_DOWN_MASK; | ||
} | ||
catch (Exception e){ | ||
System.err.println("Nem létező pálya!"); | ||
} | ||
} | ||
|
||
@Test @Order (1) | ||
public void moveTest(){ | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(20, 40); | ||
robot.mouseMove(20, 90); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(200, 90); | ||
robot.delay(ROBOT_DELAY); | ||
assertEquals("Field2", Game.Create().GetCurrentPlayer().getField().getName()); | ||
} | ||
|
||
@Test @Order (2) | ||
public void endTurnTest(){ | ||
Virologist player1 = Game.Create().GetCurrentPlayer(); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(20, 40); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(20, 270); | ||
robot.delay(ROBOT_DELAY); | ||
assertNotEquals(player1, Game.Create().GetCurrentPlayer()); | ||
robot.delay(ROBOT_DELAY); | ||
} | ||
|
||
@Test @Order (3) | ||
public void dropTest(){ | ||
clickAt(20, 40); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(20, 100); | ||
robot.delay(ROBOT_DELAY); | ||
assertEquals(0, Game.Create().GetCurrentPlayer().GetEquipments().size()); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(20, 40); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(20, 270); | ||
robot.delay(ROBOT_DELAY); | ||
} | ||
|
||
@Test @Order (4) | ||
public void equipTest(){ | ||
int numEquipment = Game.Create().GetCurrentPlayer().GetEquipments().size(); | ||
clickAt(20, 40); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(20, 230); | ||
robot.delay(ROBOT_DELAY); | ||
assertTrue(Game.Create().GetCurrentPlayer().GetEquipments().size() > numEquipment); | ||
} | ||
|
||
@Test @Order (5) | ||
public void attackTest(){ | ||
int numPlayers = Game.Create().getVirologists().size(); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(20, 40); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(20, 60); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(170, 60); | ||
robot.delay(ROBOT_DELAY); | ||
assertTrue(Game.Create().getVirologists().size() < numPlayers); | ||
} | ||
|
||
@Test @Order (6) | ||
public void endTurnTestBigButton(){ | ||
Virologist player1 = Game.Create().GetCurrentPlayer(); | ||
clickAt(530, 530); | ||
robot.delay(ROBOT_DELAY); | ||
assertNotEquals(player1, Game.Create().GetCurrentPlayer()); | ||
} | ||
|
||
@Test @Order (7) | ||
public void lootAminoFromTest(){ | ||
int amino = Game.Create().GetCurrentPlayer().GetAminoAcid(); | ||
Game.Create().GetCurrentPlayer().IncreaseLimit(20); | ||
Game.Create().GetCurrentPlayer().SetActionCount(3); | ||
clickAt(20, 40); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(20, 120); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(170, 120); | ||
assertTrue(Game.Create().GetCurrentPlayer().GetAminoAcid() > amino); | ||
} | ||
|
||
@Test @Order (8) | ||
public void lootNucleoFromTest(){ | ||
int nucleo = Game.Create().GetCurrentPlayer().GetNucleotide(); | ||
clickAt(20, 40); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(20, 150); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(170, 150); | ||
robot.delay(ROBOT_DELAY); | ||
assertTrue(Game.Create().GetCurrentPlayer().GetAminoAcid() > nucleo); | ||
} | ||
|
||
@Test @Order (9) | ||
public void lootEquipmentFromTest(){ | ||
int numEquipment = Game.Create().GetCurrentPlayer().GetEquipments().size(); | ||
clickAt(20, 40); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(20, 180); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(170, 180); | ||
robot.delay(ROBOT_DELAY); | ||
assertTrue(Game.Create().GetCurrentPlayer().GetEquipments().size() > numEquipment); | ||
} | ||
|
||
@Test @Order (10) | ||
public void collectTest(){ | ||
Field warehouse = Game.Create().GetFields().get(0); | ||
for (Field field : Game.Create().GetFields()) { | ||
if(field instanceof Warehouse){ | ||
warehouse = field; | ||
break; | ||
} | ||
} | ||
|
||
warehouse.AddVirologist(Game.Create().GetCurrentPlayer()); | ||
Game.Create().GetCurrentPlayer().IncreaseLimit(30); | ||
Game.Create().GetCurrentPlayer().SetActionCount(3); | ||
int amino = Game.Create().GetCurrentPlayer().GetAminoAcid(); | ||
int nucleo = Game.Create().GetCurrentPlayer().GetNucleotide(); | ||
clickAt(20, 40); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(20, 200); | ||
robot.delay(ROBOT_DELAY); | ||
assertTrue(Game.Create().GetCurrentPlayer().GetAminoAcid() > amino || Game.Create().GetCurrentPlayer().GetNucleotide() > nucleo); | ||
} | ||
|
||
@Test @Order (11) | ||
public void learnTest(){ | ||
Field lab = Game.Create().GetFields().get(0); | ||
for (Field field : Game.Create().GetFields()) { | ||
if(field instanceof Laboratory){ | ||
lab = field; | ||
break; | ||
} | ||
} | ||
|
||
lab.AddVirologist(Game.Create().GetCurrentPlayer()); | ||
Game.Create().GetCurrentPlayer().SetActionCount(3); | ||
int codes = Game.Create().GetCurrentPlayer().getGeneticCodes().size(); | ||
clickAt(20, 40); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(20, 210); | ||
robot.delay(ROBOT_DELAY); | ||
assertTrue(Game.Create().GetCurrentPlayer().getGeneticCodes().size() > codes); | ||
} | ||
|
||
@Test @Order (12) | ||
public void injectTest(){ | ||
int amino = Game.Create().GetCurrentPlayer().GetAminoAcid(); | ||
int nucleo = Game.Create().GetCurrentPlayer().GetNucleotide(); | ||
Game.Create().GetCurrentPlayer().AddGeneticCode(new BlockCode(10, 10, 2)); | ||
clickAt(20, 40); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(20, 250); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(170, 250); | ||
robot.delay(ROBOT_DELAY); | ||
clickAt(200, 250); | ||
robot.delay(ROBOT_DELAY); | ||
assertTrue(amino > Game.Create().GetCurrentPlayer().GetAminoAcid() || nucleo > Game.Create().GetCurrentPlayer().GetNucleotide()); | ||
} | ||
|
||
private void clickAt(int x, int y){ | ||
robot.mouseMove(x, y); | ||
robot.delay(ROBOT_DELAY); | ||
robot.mousePress(leftClick); | ||
robot.mouseRelease(leftClick); | ||
} | ||
} |