-
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 pull request #10 from BME-MIT-IET/bdd
Done #5 (BDDs)
- Loading branch information
Showing
104 changed files
with
271 additions
and
49 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 |
---|---|---|
|
@@ -10,3 +10,6 @@ | |
*.out | ||
*.OUT | ||
/bin/ | ||
.idea/ | ||
out/production/iet-hf-2024-tizenhat_tonna/palya.txt | ||
/target |
10 changes: 10 additions & 0 deletions
10
Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2/.idea/.gitignore
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
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
69 changes: 69 additions & 0 deletions
69
Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2/src/test/StepDefs.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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import Controll.Controller; | ||
import Fields.Field; | ||
import Fields.Pipe; | ||
import Players.Player; | ||
import io.cucumber.java.en.And; | ||
import io.cucumber.java.en.Given; | ||
import io.cucumber.java.en.Then; | ||
import io.cucumber.java.en.When; | ||
|
||
import java.io.FileNotFoundException; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class StepDefs { | ||
private final Map<Integer, Boolean> actionResults = new HashMap<>(); | ||
|
||
@Given("A jatek inicializalasra kerult") | ||
public void gameInitialized() { | ||
Controller.load("src/testpalya.txt"); | ||
|
||
try { | ||
Controller.Run(); // egyszer fut le, felépíti a pályát, utána a függvényeit kell majd hívni | ||
} catch (FileNotFoundException ex) { | ||
throw new RuntimeException(ex); | ||
} | ||
Controller.create(); | ||
Controller.SetActivePlayer(Controller.getAllPlayers().get(0)); | ||
} | ||
|
||
@When("{string} mozog {string} re a {int} -s scenarioban") | ||
public void movePlayer(String playerName, String toWhere, Integer scenarioNumber) { | ||
Player player = (Player) Controller.objectNames.get(playerName); | ||
Field field = (Field) Controller.objectNames.get(toWhere); | ||
actionResults.put(scenarioNumber, player.move(field)); | ||
} | ||
|
||
@Then("A művelet sikeresen végrehajtódik a\\(z) {int} -s scenarioban") | ||
public void actionSuccessful(int scenarioNumber) { | ||
assertTrue(actionResults.get(scenarioNumber)); | ||
} | ||
|
||
@Then("A művelet végrehatása sikertelen a\\(z) {int} -s scenarioban") | ||
public void actionUnsuccessful(int scenarioNumber) { | ||
assertFalse(actionResults.get(scenarioNumber)); | ||
} | ||
|
||
@When("{string} megjavitja a pumpat melyen jelenleg tartozkodik a {int} -s scenarioban") | ||
public void megjavitjaAPumpatMelyenJelenlegTartozkodikASScenarioban(String playerName, int scenarioNumber) { | ||
Player player = (Player) Controller.objectNames.get(playerName); | ||
actionResults.put(scenarioNumber, player.repair()); | ||
} | ||
|
||
@When("A {string} tonkreteszi az elemet amin jelenleg tartozkodik a {int} -s scenarioban") | ||
public void saboteurBreaksField(String playerName, int scenarioNumber) { | ||
Player player = (Player) Controller.objectNames.get(playerName); | ||
actionResults.put(scenarioNumber, player.breakField()); | ||
} | ||
|
||
@And("{string} a jelenlegi poziciojan a bemeneti csovet {string} re es kimeneti csovet {string} re csereli a {int} -s scenarioban") | ||
public void setCurrentPipeInOut(String playerName, String inPipe, String outPipe, int scenarioNumber) { | ||
Player player = (Player) Controller.objectNames.get(playerName); | ||
Pipe in = (Pipe) Controller.objectNames.get(inPipe); | ||
Pipe out = (Pipe) Controller.objectNames.get(outPipe); | ||
actionResults.put(scenarioNumber, player.set(in, out)); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions
32
...gi vizhalozatok uzemeltetese a gyakorlatban 2/src/test/resources/vizhalozat_jatek.feature
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,32 @@ | ||
Feature: Sivatagi Vízhálózat Játék | ||
|
||
Scenario: Jatekos mozgatasa egy pumparol ures csore | ||
Given A jatek inicializalasra kerult | ||
When "Mec1" mozog "AC2" re a 1 -s scenarioban | ||
Then A művelet sikeresen végrehajtódik a(z) 1 -s scenarioban | ||
|
||
Scenario: Jatekos mozgatasa egy pumparol mar foglalt csore | ||
Given A jatek inicializalasra kerult | ||
When "Mec1" mozog "AB" re a 2 -s scenarioban | ||
Then A művelet végrehatása sikertelen a(z) 2 -s scenarioban | ||
|
||
Scenario: Jatekos mozgatasa egy csorol szomszedos pumpara melyen mar tartozkodik jatekos | ||
Given A jatek inicializalasra kerult | ||
When "Sab1" mozog "A" re a 3 -s scenarioban | ||
Then A művelet sikeresen végrehajtódik a(z) 3 -s scenarioban | ||
|
||
Scenario: Szerelok megjavitjak a meghibasodott pumpat | ||
Given A jatek inicializalasra kerult | ||
When "Mec1" megjavitja a pumpat melyen jelenleg tartozkodik a 4 -s scenarioban | ||
Then A művelet sikeresen végrehajtódik a(z) 4 -s scenarioban | ||
|
||
Scenario: Szabotorok kilyukasztanak egy fontos csovet | ||
Given A jatek inicializalasra kerult | ||
When A "Sab1" tonkreteszi az elemet amin jelenleg tartozkodik a 5 -s scenarioban | ||
Then A művelet sikeresen végrehajtódik a(z) 5 -s scenarioban | ||
|
||
Scenario: Szabotorok beavatkoznak a mukodo pumpakba | ||
Given A jatek inicializalasra kerult | ||
When "Sab1" mozog "B" re a 6 -s scenarioban | ||
And "Sab1" a jelenlegi poziciojan a bemeneti csovet "BS2" re es kimeneti csovet "CB" re csereli a 6 -s scenarioban | ||
Then A művelet sikeresen végrehajtódik a(z) 6 -s scenarioban |
23 changes: 23 additions & 0 deletions
23
Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2/src/testpalya.txt
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,23 @@ | ||
cistern cistern2 water:0 draw:100:100 | ||
spring spring2 2000 draw:650:100 | ||
pump A 200 water:20 broken:true draw:200:100 | ||
pump B 200 water:10 draw:500:100 | ||
pump C 200 water:50 draw:575:200 | ||
pipe AC2 100 draw:225:125:125:125 | ||
pipe AB 100 draw:225:125:525:125 | ||
pipe BS2 100 draw:525:125:675:125 | ||
pipe CB 100 draw:600:225:525:125 | ||
connectpipe AC2 A | ||
connectpipe AC2 cistern2 | ||
connectpipe AB A | ||
connectpipe AB B | ||
connectpipe BS2 B | ||
connectpipe BS2 spring2 | ||
connectpipe CB B | ||
connectpipe CB C | ||
setpump A AB AC2 | ||
setpump B BS2 AB | ||
mechanic Mec1 A | ||
addplayer A Mec1 | ||
saboteur Sab1 AB | ||
addplayer AB Sab1 |
Binary file added
BIN
+50 KB
...eltetese a gyakorlatban 2/target/hu.bme.mit.iet.hf.2024.tizenhat_tonna-0.5.0-SNAPSHOT.jar
Binary file not shown.
24 changes: 24 additions & 0 deletions
24
...tban 2/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
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,24 @@ | ||
Drawing\Drawable.class | ||
Fields\ActiveFields\Spring.class | ||
Controll\ViewGame$2.class | ||
Fields\ActiveFields\ActiveFields.class | ||
Drawing\PipeDraw.class | ||
Players\Saboteur.class | ||
Drawing\MechanicDraw.class | ||
Controll\Controller.class | ||
Fields\Pipe.class | ||
Controll\ViewGame$1.class | ||
Drawing\SpringDraw.class | ||
Controll\ViewGame.class | ||
Enums\Fluid.class | ||
Interfaces\Steppable.class | ||
Drawing\PumpDraw.class | ||
Drawing\SaboteurDraw.class | ||
Drawing\CisternDraw.class | ||
Controll\WaterCounter.class | ||
Controll\Menu.class | ||
Fields\ActiveFields\Cistern.class | ||
Fields\ActiveFields\Pump.class | ||
Players\Player.class | ||
Fields\Field.class | ||
Players\Mechanic.class |
22 changes: 22 additions & 0 deletions
22
...latban 2/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
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,22 @@ | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Drawing\Drawable.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Fields\ActiveFields\Spring.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Players\Saboteur.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Enums\Fluid.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Fields\ActiveFields\Pump.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Fields\Pipe.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Drawing\PipeDraw.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Drawing\SaboteurDraw.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Interfaces\Steppable.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Drawing\CisternDraw.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Fields\ActiveFields\ActiveFields.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Players\Mechanic.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Controll\WaterCounter.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Controll\Controller.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Players\Player.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Drawing\PumpDraw.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Fields\Field.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Fields\ActiveFields\Cistern.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Controll\ViewGame.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Controll\Menu.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Drawing\MechanicDraw.java | ||
H:\Raktar-6\Integra\H�zi feladat\Sivatagi vizhalozatok uzemeltetese a gyakorlatban 2\src\Drawing\SpringDraw.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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Vízhálózat Játék BDD Dokumentáció | ||
|
||
Ez a dokumentáció leírja a "Sivatagi vízhálózat" nevű játék funkcióit és működését BDD (Behavior-Driven Development) forgatókönyvek segítségével. | ||
|
||
A BDD tesztek megvalósításához a [Cucumber](https://cucumber.io/) keretrendszert használjuk. Melyhez egy feature file-t és egy step definition osztály-t kell létrehozni a projekt test könyvtárában. | ||
Ezt követően a featurefileban megírva bárki számára olvasható formátumban a teszteket és az ezekhez tartozó step definitionöket a Given, When és Then annotationöket használva már futtathatjuk is a teszteket. | ||
A Step Definition osztályban a tesztekhez tartozó metódusokban kell megvalósítani a tesztek lépéseit a valós programmal. | ||
|
||
## Scenariok: | ||
## 1. A játékosok mozognak a csöveken | ||
|
||
### Scenario: Játékos mozgatása egy pumpáról üres csőre. | ||
A szerelő csapat egyik játékosa az egyik egy pumpáról egy szomszédos csőre lép melyen nem tartózkodik másik játékos. A műveletet sikeresen végrehajtja. | ||
|
||
### Scenario: Játékos mozgatása egy pumpáról már foglalt csőre. | ||
A szerelő csapat egyik játékosa az egyik szerelővel egy pumpáról egy szomszédos csőre lép melyen jelenleg tartózkodik egy másik játékos. A műveletet végrehajtása sikertelen. | ||
|
||
### Scenario: Játékos mozgatása egy csőröl szomszédos pumpára melyen már tartózkodik játékos. | ||
A szerelő csapat egyik játékosa az egyik szerelővel egy csőröl egy szomszédos pumpára lép melyen jelenleg tartózkodik egy másik játékos. A műveletet végrehajtása sikeres. | ||
|
||
## 2. Szerelők a Vízhálózat Javítása | ||
|
||
### Scenario: Szerelők megjavítják a meghibásodott pumpát | ||
A játékban egy meghibásodott pumpa van a csőhálózatban. A szerelőknek lehetőségük van megjavítani ezt a pumpát. | ||
|
||
## 3. Szabotőrök a Vízhálózat Károsítása | ||
|
||
### Scenario: Szabotőrök kilyukasztanak egy fontos csövet | ||
A csőhálózatban található egy fontos cső, amit a szabotőrök kilyukasztanak. Ennek következtében vízveszteség keletkezik, csökkentve a vízszállítás hatékonyságát. | ||
|
||
### Scenario: Szabotőrök beavatkoznak a működő pumpákba | ||
A szabotőrök módosítják a működő pumpák beállításait, hogy csökkentsék a vízszállítás hatékonyságát a csőhálózatban. |
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,52 +1,57 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>hu.bme.mit.iet.hf.2024.tizenhat_tonna</groupId> | ||
<artifactId>hu.bme.mit.iet.hf.2024.tizenhat_tonna</artifactId> | ||
<version>0.5.0-SNAPSHOT</version> | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>hu.bme.mit.iet.hf.2024.tizenhat_tonna</groupId> | ||
<artifactId>hu.bme.mit.iet.hf.2024.tizenhat_tonna</artifactId> | ||
<version>0.5.0-SNAPSHOT</version> | ||
|
||
<properties> | ||
<sonar.organization>bme-mit-iet-org</sonar.organization> | ||
<sonar.host.url>https://sonarcloud.io</sonar.host.url> | ||
</properties> | ||
<properties> | ||
<sonar.organization>bme-mit-iet-org</sonar.organization> | ||
<sonar.host.url>https://sonarcloud.io</sonar.host.url> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<version>5.8.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<version>4.4.0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jacoco</groupId> | ||
<artifactId>jacoco-maven-plugin</artifactId> | ||
<version>0.8.7</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<version>5.8.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<version>4.4.0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jacoco</groupId> | ||
<artifactId>jacoco-maven-plugin</artifactId> | ||
<version>0.8.7</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.cucumber</groupId> | ||
<artifactId>cucumber-java</artifactId> | ||
<version>7.17.0</version> | ||
</dependency> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.10.1</version> | ||
<configuration> | ||
<release>11</release> | ||
</configuration> | ||
</plugin> | ||
</dependencies> | ||
|
||
<!-- JUnit 5 requires Surefire version 2.22.1 or higher --> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.22.2</version> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.10.1</version> | ||
<configuration> | ||
<release>11</release> | ||
</configuration> | ||
</plugin> | ||
|
||
<!-- JUnit 5 requires Surefire version 2.22.1 or higher --> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.22.2</version> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |