-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'refs/remotes/origin/BDD-tesztek-Cucumber'
- Loading branch information
Showing
32 changed files
with
468 additions
and
15 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,48 @@ | ||
# BDD tesztek - Cucumber | ||
|
||
## Szerelő javít tesztek | ||
|
||
### Cső megjavítása | ||
- Van egy elromlott cső, amin áll egy szerelő, és ezt megpróbálja megjavítani. | ||
- Ezután a csőnek megjavítottnak kell lennie. | ||
|
||
### Pumpa megjavítása | ||
- Van egy elromlott pumpa, amin áll egy szerelő, és ezt megpróbálja megjavítani. | ||
- Ezután a pumpának megjavítottnak kell lennie. | ||
|
||
## Szabotőr akciók egy csövön tesztek | ||
|
||
### Cső elrontása | ||
- Van egy nem elromlott cső, amin áll egy szabotőr, és ezt megpróbálja elrontani. | ||
- Ezután a csőnek elromlottnak kell lennie. | ||
|
||
### Cső csúszóssá tevése | ||
- Van egy cső, amin áll egy szabotőr, és ezt megpróbálja csúszóssá tenni. | ||
- Ezután a csőnek csúszósnak kell lennie. | ||
|
||
### Cső ragadóssá tevése | ||
- Van egy cső, amin áll egy szabotőr, és ezt megpróbálja ragadóssá tenni. | ||
- Ezután a csőnek ragadósnak kell lennie. | ||
|
||
## Szerelő akciók egy ciszternán tesztek | ||
|
||
### Cső elvétele | ||
- Van egy ciszterna, amin áll egy szerelő, és megpróbál elvenni egy csövet a ciszternából. | ||
- Ezután a ciszternában már csak 4 csőnek kell lennie, és a szerelőnél, kell aktív elemnek lennie. | ||
|
||
### Pumpa elvétele | ||
- Van egy ciszterna, amin áll egy szerelő, és megpróbál elvenni egy pumpát a ciszternából. | ||
- Ezután a ciszternában már nem szabad pumpának lennie, és a szerelőnél, kell aktív elemnek lennie. | ||
|
||
## Játékosok mozgatása tesztek | ||
|
||
### Egy játékos egy csőre lép | ||
- Egy szerelő a kezdőpozíciójában, éppen egy ciszternán áll. Tudván, hogy jobbra tőle egy üres cső található, átlép arra a mezőre. | ||
- Az **assertEquals** összehasonlító függvénnyel ellenőrzi a teszt végén, hogy a szerelő jelenlegi mezője, amelyen tartózkodik valóban megváltozott-e a szomszédos csőre, illetve a szomszédos csövön beállítódik-e, hogy rajta tartózkodik a szerelő. | ||
|
||
### Két játékos egy azonos pumpára lép | ||
- Egy szerelő a kezdőpozíciójában, éppen egy ciszternán áll. Emellett egy másik játékost, a teszt esetében egy szabotőrt a ciszternától kettővel odébb lévő csőre van elhelyezve. A ciszterna és a cső közé egy pumpa lett letéve, amelyen egyszerre több játékos is tartózkodhat. Mindkét játékos átlép a mezőjükről a szomszédos pumpára. | ||
- Az **assertEquals** összehasonlító függvénnyel ellenőrzi a teszt végén, hogy mind a szerelő és mind a szabötőr jelenlegi mezője, amelyen tartózkodnak valóban megváltozott-e a szomszédos pumpára, illetve a szomszédos pumpán beállítódik-e, hogy rajta tartózkodik a mindkét játékos. | ||
|
||
## Összefoglalás | ||
A szerintünk átfogó és részletes tesztek megírása után végre is hajtottuk őket, és mindegyikre az elvárt viselkedést kaptuk. A legfontosabb funkciókat többnyire sikerült letesztelni, azonban nehézségeket okozott pár helyen a Getter/Setter függvények hiánya, amely miatt pár esetet nem lehetett/nehezebb volt megvizsgálni. De a végrehajtott tesztek alapján a program helyesen funkcionálónak tűnik. |
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
2 changes: 2 additions & 0 deletions
2
src/main/java/ActionHandler.java → ...ava/drukmakoriSzerelok/ActionHandler.java
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package drukmakoriSzerelok; | ||
|
||
import java.util.*; | ||
|
||
/** | ||
|
2 changes: 2 additions & 0 deletions
2
src/main/java/Active.java → src/main/java/drukmakoriSzerelok/Active.java
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
2 changes: 2 additions & 0 deletions
2
src/main/java/BlankField.java → ...n/java/drukmakoriSzerelok/BlankField.java
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package drukmakoriSzerelok; | ||
|
||
import java.util.ArrayList; | ||
import java.util.UUID; | ||
|
||
|
2 changes: 2 additions & 0 deletions
2
src/main/java/Field.java → src/main/java/drukmakoriSzerelok/Field.java
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package drukmakoriSzerelok; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
|
2 changes: 2 additions & 0 deletions
2
src/main/java/Fixer.java → src/main/java/drukmakoriSzerelok/Fixer.java
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package drukmakoriSzerelok; | ||
|
||
import java.util.ArrayList; | ||
|
||
/** | ||
|
2 changes: 2 additions & 0 deletions
2
src/main/java/Fountain.java → ...ain/java/drukmakoriSzerelok/Fountain.java
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package drukmakoriSzerelok; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.UUID; | ||
|
2 changes: 2 additions & 0 deletions
2
src/main/java/Game.java → src/main/java/drukmakoriSzerelok/Game.java
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package drukmakoriSzerelok; | ||
|
||
import java.util.ArrayList; | ||
|
||
/** | ||
|
2 changes: 2 additions & 0 deletions
2
src/main/java/GameField.java → ...in/java/drukmakoriSzerelok/GameField.java
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package drukmakoriSzerelok; | ||
|
||
import java.awt.*; | ||
import java.util.ArrayList; | ||
import javax.swing.*; | ||
|
2 changes: 2 additions & 0 deletions
2
src/main/java/GameFrame.java → ...in/java/drukmakoriSzerelok/GameFrame.java
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package drukmakoriSzerelok; | ||
|
||
import java.awt.*; | ||
import java.awt.event.*; | ||
import java.awt.geom.AffineTransform; | ||
|
2 changes: 2 additions & 0 deletions
2
src/main/java/HelpFrame.java → ...in/java/drukmakoriSzerelok/HelpFrame.java
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package drukmakoriSzerelok; | ||
|
||
import java.awt.*; | ||
import javax.swing.*; | ||
|
||
|
2 changes: 2 additions & 0 deletions
2
src/main/java/Main.java → src/main/java/drukmakoriSzerelok/Main.java
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package drukmakoriSzerelok; | ||
|
||
import java.io.*; | ||
|
||
/** | ||
|
2 changes: 2 additions & 0 deletions
2
src/main/java/MainMenu.java → ...ain/java/drukmakoriSzerelok/MainMenu.java
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package drukmakoriSzerelok; | ||
|
||
import java.awt.*; | ||
import java.awt.event.*; | ||
import java.io.File; | ||
|
2 changes: 2 additions & 0 deletions
2
src/main/java/Map.java → src/main/java/drukmakoriSzerelok/Map.java
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package drukmakoriSzerelok; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
|
2 changes: 2 additions & 0 deletions
2
src/main/java/Pipe.java → src/main/java/drukmakoriSzerelok/Pipe.java
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package drukmakoriSzerelok; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Random; | ||
|
2 changes: 2 additions & 0 deletions
2
src/main/java/Player.java → src/main/java/drukmakoriSzerelok/Player.java
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package drukmakoriSzerelok; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Random; | ||
|
||
|
2 changes: 2 additions & 0 deletions
2
src/main/java/Pump.java → src/main/java/drukmakoriSzerelok/Pump.java
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package drukmakoriSzerelok; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Random; | ||
|
2 changes: 2 additions & 0 deletions
2
src/main/java/Saboteur.java → ...ain/java/drukmakoriSzerelok/Saboteur.java
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package drukmakoriSzerelok; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Random; | ||
|
||
|
2 changes: 2 additions & 0 deletions
2
src/main/java/SettingsFrame.java → ...ava/drukmakoriSzerelok/SettingsFrame.java
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package drukmakoriSzerelok; | ||
|
||
import java.awt.*; | ||
import java.awt.event.*; | ||
import java.util.ArrayList; | ||
|
2 changes: 2 additions & 0 deletions
2
src/main/java/Steppable.java → ...in/java/drukmakoriSzerelok/Steppable.java
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
2 changes: 2 additions & 0 deletions
2
src/main/java/Tank.java → src/main/java/drukmakoriSzerelok/Tank.java
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package drukmakoriSzerelok; | ||
|
||
import java.util.*; | ||
|
||
/** | ||
|
2 changes: 2 additions & 0 deletions
2
src/main/java/Wait.java → src/main/java/drukmakoriSzerelok/Wait.java
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package drukmakoriSzerelok; | ||
|
||
/** | ||
* Várakozast iranyito es vegrehajto osztaly. | ||
*/ | ||
|
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,12 @@ | ||
package cucumberTest; | ||
|
||
import io.cucumber.junit.CucumberOptions; | ||
import org.junit.runner.RunWith; | ||
import io.cucumber.junit.Cucumber; | ||
|
||
|
||
@RunWith(Cucumber.class) | ||
@CucumberOptions() | ||
public class CucumberTestRunner { | ||
} | ||
|
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,57 @@ | ||
package cucumberTest; | ||
|
||
import drukmakoriSzerelok.Game; | ||
import drukmakoriSzerelok.Tank; | ||
import drukmakoriSzerelok.Fixer; | ||
|
||
import io.cucumber.java.en.Given; | ||
import io.cucumber.java.en.Then; | ||
import io.cucumber.java.en.When; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class FixerActionsOnTank { | ||
private Tank tank = new Tank(); | ||
private Fixer fixer = new Fixer("fixer1",""); | ||
|
||
public FixerActionsOnTank(){ | ||
Game.Get().SetActivePlayer(fixer); | ||
} | ||
|
||
@Given("a tank") | ||
public void a_tank() { | ||
Game game = Game.Get(); | ||
} | ||
|
||
@Given("the fixer currently standing on that tank") | ||
public void the_fixer_currently_standing_on_that_tank() { | ||
fixer.SetField(tank); | ||
tank.AddPlayer(fixer); | ||
} | ||
|
||
@When("the saboteur tries to carry a pipe") | ||
public void the_saboteur_tries_to_carry_a_pipe() { | ||
fixer.CarryPipe(tank); | ||
} | ||
|
||
@When("the saboteur tries to carry a pump") | ||
public void the_saboteur_tries_to_carry_a_pump() { | ||
fixer.CarryPump(tank); | ||
} | ||
|
||
@Then("the tank should have {string} pipes") | ||
public void the_tank_should_have_pipes(String answer){ | ||
assertEquals(answer, String.valueOf(tank.getNumberOfPipes())); | ||
} | ||
|
||
@Then("the tank should have {string} pumps") | ||
public void the_tank_should_have_pumps(String answer){ | ||
assertEquals(answer, String.valueOf(tank.getNumberOfPumps())); | ||
} | ||
|
||
@Then("the fixer should {string}have an active field") | ||
public void the_fixer_should_have_an_active_field(String answer){ | ||
var result = fixer.GetHasActive() ? "" : "not "; | ||
assertEquals(answer, result); | ||
} | ||
} |
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,65 @@ | ||
package cucumberTest; | ||
|
||
import drukmakoriSzerelok.Fixer; | ||
import drukmakoriSzerelok.Game; | ||
import drukmakoriSzerelok.Pipe; | ||
import drukmakoriSzerelok.Pump; | ||
|
||
import io.cucumber.java.en.Given; | ||
import io.cucumber.java.en.Then; | ||
import io.cucumber.java.en.When; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
class IsItBroken{ | ||
static String isItBroken(boolean status) { | ||
return status ? "fixed" : "broken"; | ||
} | ||
} | ||
|
||
public class FixerFixes { | ||
private Pipe pipe = new Pipe(); | ||
private Pump pump = new Pump(); | ||
private Fixer fixer = new Fixer("fixer1",""); | ||
|
||
private boolean result; | ||
|
||
public FixerFixes(){ | ||
Game.Get().SetActivePlayer(fixer); | ||
} | ||
|
||
@Given("a broken pipe") | ||
public void a_broken_pipe() { | ||
pipe.SetIsBroken(true); | ||
Game game = Game.Get(); | ||
} | ||
|
||
@Given("a broken pump") | ||
public void a_broken_pump() { | ||
pump.SetIsBroken(true); | ||
Game game = Game.Get(); | ||
} | ||
|
||
@Given("the fixer currently standing on that pipe") | ||
public void the_fixer_currently_standing_on_that_pipe() { | ||
fixer.SetField(pipe); | ||
pipe.AddPlayer(fixer); | ||
} | ||
|
||
@Given("the fixer currently standing on that pump") | ||
public void the_fixer_currently_standing_on_that_pump() { | ||
fixer.SetField(pump); | ||
pump.AddPlayer(fixer); | ||
} | ||
|
||
@When("the fixer tries to repair that") | ||
public void the_fixer_tries_to_repair_that(){ | ||
fixer.Fix(pipe); | ||
result = ! pipe.GetIsBroken(); | ||
} | ||
|
||
@Then("it should be {string}") | ||
public void it_should_be(String answer){ | ||
assertEquals(answer, IsItBroken.isItBroken(result)); | ||
} | ||
} |
Oops, something went wrong.