Commit dc291600 authored by Aneta Steimarova's avatar Aneta Steimarova

#941 Created tests for game Robbery bonus difficulty

parent e05798b5
TestGameShootingRangeEasyNoneStar
TestGameShootingRangeEasyOneStar
TestGameShootingRangeEasyTwoStar
TestGameShootingRangeEasyThreeStar
TestGameShootingRangeMediumNoneStar
TestGameShootingRangeMediumOneStar
TestGameShootingRangeMediumTwoStar
TestGameShootingRangeMediumThreeStar
TestGameShootingRangeHardNoneStar
TestGameShootingRangeHardOneStar
TestGameShootingRangeHardTwoStar
TestGameShootingRangeHardThreeStar
TestGameShootingRangeBonusNoneStar
TestGameShootingRangeBonusOneStar
TestGameShootingRangeBonusTwoStar
TestGameShootingRangeBonusThreeStar
TestGameSafeEasyNoneStars
TestGameSafeEasyOneStars
TestGameSafeEasyTwoStars
TestGameSafeEasyThreeStars
TestGameSafeMediumNoneStars
TestGameSafeMediumOneStar
TestGameSafeMediumTwoStars
TestGameSafeMediumThreeStars
TestGameSafeHardNoneStars
TestGameSafeHardOneStar
TestGameSafeHardTwoStars
TestGameSafeHardThreeStars
TestGameSafeBonusNoneStars
TestGameSafeBonusOneStars
TestGameSafeBonusTwoStars
TestGameSafeBonusThreeStars
TestGameCrimeSceneEasyNoneStar
TestGameCrimeSceneEasyOneStar
TestGameCrimeSceneEasyTwoStar
TestGameCrimeSceneEasyThreeStar
TestGameCrimeSceneMediumNoneStar
TestGameCrimeSceneMediumOneStar
TestGameCrimeSceneMediumTwoStar
TestGameCrimeSceneMediumThreeStar
TestGameCrimeSceneHardNoneStar
TestGameCrimeSceneHardOneStar
TestGameCrimeSceneHardTwoStar
TestGameCrimeSceneHardThreeStar
TestGameCrimeSceneBonusNoneStar
TestGameCrimeSceneBonusOneStar
TestGameCrimeSceneBonusTwoStar
TestGameCrimeSceneBonusThreeStar
TestGameRunesEasyNoneStar
TestGameRunesEasyOneStar
TestGameRunesEasyTwoStar
......@@ -13,4 +61,20 @@ TestGameRunesHardThreeStar
TestGameRunesBonusNoneStar
TestGameRunesBonusOneStar
TestGameRunesBonusTwoStars
TestGameRunesBonusThreeStars
\ No newline at end of file
TestGameRunesBonusThreeStars
TestGameRobberyEasyNoneStar
TestGameRobberyEasyOneStar
TestGameRobberyEasyTwoStar
TestGameRobberyEasyThreeStar
TestGameRobberyMediumNoneStar
TestGameRobberyMediumOneStar
TestGameRobberyMediumTwoStar
TestGameRobberyMediumThreeStar
TestGameRobberyHardNoneStar
TestGameRobberyHardOneStar
TestGameRobberyHardTwoStar
TestGameRobberyHardThreeStar
TestGameRobberyBonusNoneStar
TestGameRobberyBonusOneStar
TestGameRobberyBonusTwoStars
TestGameRobberyBonusThreeStars
\ No newline at end of file
......@@ -39,6 +39,10 @@ TestGameRobberyHardNoneStar
TestGameRobberyHardOneStar
TestGameRobberyHardTwoStar
TestGameRobberyHardThreeStar
TestGameRobberyBonusNoneStar
TestGameRobberyBonusOneStar
TestGameRobberyBonusTwoStars
TestGameRobberyBonusThreeStars
TestGameInTheDarknessEasy
TestGameInTheDarknessMedium
TestGameInTheDarknessHard
......
......@@ -97,6 +97,10 @@ import cz.nic.tablexia.testing.games.pursiut.TestGamePursuitMediumNoneStar;
import cz.nic.tablexia.testing.games.pursiut.TestGamePursuitMediumOneStar;
import cz.nic.tablexia.testing.games.pursiut.TestGamePursuitMediumThreeStar;
import cz.nic.tablexia.testing.games.pursiut.TestGamePursuitMediumTwoStar;
import cz.nic.tablexia.testing.games.robbery.TestGameRobberyBonusNoneStar;
import cz.nic.tablexia.testing.games.robbery.TestGameRobberyBonusOneStar;
import cz.nic.tablexia.testing.games.robbery.TestGameRobberyBonusThreeStars;
import cz.nic.tablexia.testing.games.robbery.TestGameRobberyBonusTwoStars;
import cz.nic.tablexia.testing.games.robbery.TestGameRobberyEasyNoneStar;
import cz.nic.tablexia.testing.games.robbery.TestGameRobberyEasyOneStar;
import cz.nic.tablexia.testing.games.robbery.TestGameRobberyEasyThreeStar;
......@@ -215,6 +219,10 @@ public class TestRunner {
listOfTests.add(TestGameRobberyHardOneStar.class);
listOfTests.add(TestGameRobberyHardTwoStar.class);
listOfTests.add(TestGameRobberyHardThreeStar.class);
listOfTests.add(TestGameRobberyBonusNoneStar.class);
listOfTests.add(TestGameRobberyBonusOneStar.class);
listOfTests.add(TestGameRobberyBonusTwoStars.class);
listOfTests.add(TestGameRobberyBonusThreeStars.class);
listOfTests.add(TestGameInTheDarknessEasy.class);
listOfTests.add(TestGameInTheDarknessMedium.class);
listOfTests.add(TestGameInTheDarknessHard.class);
......
......@@ -26,6 +26,7 @@ import cz.nic.tablexia.TablexiaApplication;
import cz.nic.tablexia.TablexiaSettings;
import cz.nic.tablexia.game.AbstractTablexiaGame;
import cz.nic.tablexia.game.GameDefinition;
import cz.nic.tablexia.game.difficulty.GameDifficulty;
import cz.nic.tablexia.game.games.robbery.GameScreen;
import cz.nic.tablexia.game.games.robbery.RobberyGame;
import cz.nic.tablexia.game.games.robbery.RuleScreen;
......@@ -81,6 +82,7 @@ public class TestGameRobbery extends AbstractTestGame {
clickAt(incGetSteps() + ". Click at medium difficulty button", GamePageGroup.DIFFICULTY_BUTTON_MEDIUM);
clickAt(incGetSteps() + ". Click at hard difficulty button", GamePageGroup.DIFFICULTY_BUTTON_HARD);
clickAt(incGetSteps() + ". Click at easy difficulty button", GamePageGroup.DIFFICULTY_BUTTON_EASY);
clickAt(incGetSteps() + ". Click at bonus difficulty button", GamePageGroup.DIFFICULTY_BUTTON_BONUS);
//setDifficulty
setGameDificulty();
......@@ -132,12 +134,17 @@ public class TestGameRobbery extends AbstractTestGame {
@Override
protected int getCubsCount() {
if (gameScore >= RobberyScoreResolver.FINAL_SCORE_THREE_STARS) return 3;
else if(gameScore >= RobberyScoreResolver.FINAL_SCORE_TWO_STARS) return 2;
else if(gameScore >= RobberyScoreResolver.FINAL_SCORE_ONE_STAR) return 1;
return 0;
if(difficulty == GameDifficulty.BONUS){
if (gameScore >= RobberyScoreResolver.BONUS_SCORE_THREE_STARS) return 3;
else if(gameScore >= RobberyScoreResolver.BONUS_SCORE_TWO_STARS) return 2;
else if(gameScore >= RobberyScoreResolver.BONUS_SCORE_ONE_STAR) return 1;
else return 0;
} else{
if (gameScore >= RobberyScoreResolver.FINAL_SCORE_THREE_STARS) return 3;
else if(gameScore >= RobberyScoreResolver.FINAL_SCORE_TWO_STARS) return 2;
else if(gameScore >= RobberyScoreResolver.FINAL_SCORE_ONE_STAR) return 1;
else return 0;
}
}
@Override
......@@ -173,8 +180,11 @@ public class TestGameRobbery extends AbstractTestGame {
stopTheTest();
}
if(!checkScoreInTable(table,Integer.toString(daoScore) + "/" + Integer.toString(RobberyDifficultyDefinition.DEFAULT_CREATURES_COUNT))){
logError("Not found label in " + AbstractTablexiaGame.RESULT_TABLE+ " with correct dao score: " + Integer.toString(daoScore) + "/" + Integer.toString(RobberyDifficultyDefinition.DEFAULT_CREATURES_COUNT) );
String score = (difficulty == GameDifficulty.BONUS) ? Integer.toString(daoScore) : Integer.toString(daoScore) + "/" + Integer.toString(RobberyDifficultyDefinition.DEFAULT_CREATURES_COUNT);
if(!checkScoreInTable(table,score)){
if(difficulty != GameDifficulty.BONUS)logError("Not found label in " + AbstractTablexiaGame.RESULT_TABLE + " with correct dao score: " + Integer.toString(daoScore) + "/" + Integer.toString(RobberyDifficultyDefinition.DEFAULT_CREATURES_COUNT) );
else logError("Not found label in " + AbstractTablexiaGame.RESULT_TABLE + " with correct dao score: " + Integer.toString(daoScore));
stopTheTest();
}
}
......@@ -184,9 +194,9 @@ public class TestGameRobbery extends AbstractTestGame {
int mistakesInRound = 0;
while (numberCreature <= RobberyDifficultyDefinition.DEFAULT_CREATURES_COUNT) {
int creaturesCount = (difficulty == GameDifficulty.BONUS) ? 110 : RobberyDifficultyDefinition.DEFAULT_CREATURES_COUNT;
while (numberCreature <= creaturesCount) {
waitForEvent(incGetSteps() + ". Wait for creature middle event",GameScreen.EVENT_CREATURE_MIDDLE+numberCreature);
CreatureRoot creature = (CreatureRoot) findActorInRobbery(GameScreen.CREATURE + numberCreature);
......@@ -231,10 +241,25 @@ public class TestGameRobbery extends AbstractTestGame {
private boolean doMistake(){
if(expectedResult == AbstractTablexiaGame.GameResult.TWO_STAR && gameScore >= RobberyScoreResolver.FINAL_SCORE_THREE_STARS -2){ return true;}
else if(expectedResult == AbstractTablexiaGame.GameResult.ONE_STAR && gameScore >= RobberyScoreResolver.FINAL_SCORE_TWO_STARS -2) { return true;}
else if(expectedResult == AbstractTablexiaGame.GameResult.NO_STAR && gameScore >= RobberyScoreResolver.FINAL_SCORE_ONE_STAR -2) { return true;}
else return false;
if(difficulty == GameDifficulty.BONUS){
if (expectedResult == AbstractTablexiaGame.GameResult.THREE_STAR && gameScore >= RobberyScoreResolver.BONUS_SCORE_THREE_STARS + 2) {
return true;
} else if (expectedResult == AbstractTablexiaGame.GameResult.TWO_STAR && gameScore >= RobberyScoreResolver.BONUS_SCORE_THREE_STARS - 2) {
return true;
} else if (expectedResult == AbstractTablexiaGame.GameResult.ONE_STAR && gameScore >= RobberyScoreResolver.BONUS_SCORE_TWO_STARS - 2) {
return true;
} else if (expectedResult == AbstractTablexiaGame.GameResult.NO_STAR && gameScore >= RobberyScoreResolver.BONUS_SCORE_ONE_STAR - 2) {
return true;
} else return false;
} else {
if (expectedResult == AbstractTablexiaGame.GameResult.TWO_STAR && gameScore >= RobberyScoreResolver.FINAL_SCORE_THREE_STARS - 2) {
return true;
} else if (expectedResult == AbstractTablexiaGame.GameResult.ONE_STAR && gameScore >= RobberyScoreResolver.FINAL_SCORE_TWO_STARS - 2) {
return true;
} else if (expectedResult == AbstractTablexiaGame.GameResult.NO_STAR && gameScore >= RobberyScoreResolver.FINAL_SCORE_ONE_STAR - 2) {
return true;
} else return false;
}
}
......
/*
* Copyright (C) 2017 CZ.NIC, z.s.p.o. (http://www.nic.cz/)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cz.nic.tablexia.testing.games.robbery;
import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.game.AbstractTablexiaGame;
import cz.nic.tablexia.game.difficulty.GameDifficulty;
public class TestGameRobberyBonusNoneStar extends TestGameRobbery {
public TestGameRobberyBonusNoneStar(Tablexia tablexia) {
super(tablexia);
difficulty = GameDifficulty.BONUS;
expectedResult = AbstractTablexiaGame.GameResult.NO_STAR;
}
}
/*
* Copyright (C) 2017 CZ.NIC, z.s.p.o. (http://www.nic.cz/)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cz.nic.tablexia.testing.games.robbery;
import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.game.AbstractTablexiaGame;
import cz.nic.tablexia.game.difficulty.GameDifficulty;
public class TestGameRobberyBonusOneStar extends TestGameRobbery {
public TestGameRobberyBonusOneStar(Tablexia tablexia) {
super(tablexia);
difficulty = GameDifficulty.BONUS;
expectedResult = AbstractTablexiaGame.GameResult.ONE_STAR;
}
}
/*
* Copyright (C) 2017 CZ.NIC, z.s.p.o. (http://www.nic.cz/)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cz.nic.tablexia.testing.games.robbery;
import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.game.AbstractTablexiaGame;
import cz.nic.tablexia.game.difficulty.GameDifficulty;
public class TestGameRobberyBonusThreeStars extends TestGameRobbery {
public TestGameRobberyBonusThreeStars(Tablexia tablexia) {
super(tablexia);
difficulty = GameDifficulty.BONUS;
expectedResult = AbstractTablexiaGame.GameResult.THREE_STAR;
}
}
/*
* Copyright (C) 2017 CZ.NIC, z.s.p.o. (http://www.nic.cz/)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cz.nic.tablexia.testing.games.robbery;
import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.game.AbstractTablexiaGame;
import cz.nic.tablexia.game.difficulty.GameDifficulty;
public class TestGameRobberyBonusTwoStars extends TestGameRobbery {
public TestGameRobberyBonusTwoStars(Tablexia tablexia) {
super(tablexia);
difficulty = GameDifficulty.BONUS;
expectedResult = AbstractTablexiaGame.GameResult.TWO_STAR;
}
}
......@@ -10,3 +10,7 @@ TestGameRobberyHardNoneStar
TestGameRobberyHardOneStar
TestGameRobberyHardTwoStar
TestGameRobberyHardThreeStar
TestGameRobberyBonusNoneStar
TestGameRobberyBonusOneStar
TestGameRobberyBonusTwoStars
TestGameRobberyBonusThreeStars
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment