Question:
Walk me through your test plan. Give an example where a test case later found a bug in your code by things a teammate added later. (Or explain why you chose a test case specifically because you wanted to ensure that a teammate would know if they broke your code.)
Explanation: (BC Note: More teses are needed but these are explained well)
Door Tests:
Door Tests Code
- LeftDoorIsWorking() – This test is actually three tests bundled together, I did this because the three tests are essential to the functionality of the door working and if one of them fails I know I need to immediately fix it. This test makes sure that the left door is active when it is supposed to be active, or essentially when there is a room left of the current room it is active and has its destination set to the room left of this one. This test makes sure that the door is inactive when it is supposed to be inactive, or essentially when there is no room to the left that the left door does not spawn. And the last thing this test tests is it makes absolutely sure the left door never spawns on the left edge of the map grid, if this were to happen that would mean the entire structure of the map has decayed and that both the doors and the map need immediate attention.
- TopDoorIsWorking() – This test is actually three tests bundled together, I did this because the three tests are essential to the functionality of the door working and if one of them fails I know I need to immediately fix it. This test makes sure that the top door is active when it is supposed to be active, or essentially when there is a room above the current room it is active and has its destination set to the room above this one. This test makes sure that the door is inactive when it is supposed to be inactive, or essentially when there is no room above that the top door does not spawn. And the last thing this test tests is it makes absolutely sure the top door never spawns on the top edge of the map grid, if this were to happen that would mean the entire structure of the map has decayed and that both the doors and the map need immediate attention.
- RightDoorIsWorking – This test is actually three tests bundled together, I did this because the three tests are essential to the functionality of the door working and if one of them fails, I know I need to immediately fix it. This test makes sure that the right door is active when it is supposed to be active, or essentially when there is a room to the right of the current room it is active and has its destination set to the room right of this one. This test makes sure that the door is inactive when it is supposed to be inactive, or essentially when there is no room to the right that the right door does not spawn. And the last thing this test tests is it makes absolutely sure the right door never spawns on the right edge of the map grid, if this were to happen that would mean the entire structure of the map has decayed and that both the doors and the map need immediate attention.
- BottomDoorIsWorking – This test is actually three tests bundled together, I did this because the three tests are essential to the functionality of the door working and if one of them fails I know I need to immediately fix it. This test makes sure that the bottom door is active when it is supposed to be active, or essentially when there is a room below the current room it is active and has its destination set to the room below this one. This test makes sure that the door is inactive when it is supposed to be inactive, or essentially when there is no room below that the top door does not spawn. And the last thing this test tests is it makes absolutely sure the bottom door never spawns on the bottom edge of the map grid, if this were to happen that would mean the entire structure of the map has decayed and that both the doors and the map need immediate attention.
- BottomDoorFoundGrombo() – This test makes sure that the bottom door has found grombo in the scenes that the door is active, this will trigger a success for the test if the door is active and grombo is in the room or if the door is inactive because in that case it wouldn’t matter if grombo was in the room. If the door couldn’t find grombo when the room spawned then the door would not be able to properly use the transport() method and would cause immense issues.
- LeftDoorFoundGrombo() – This test makes sure that the left door has found grombo in the scenes that the door is active, this will trigger a success for the test if the door is active and grombo is in the room or if the door is inactive because in that case it wouldn’t matter if grombo was in the room. If the door couldn’t find grombo when the room spawned then the door would not be able to properly use the transport() method and would cause immense issues.
- RightDoorFoundGrombo() – This test makes sure that the right door has found grombo in the scenes that the door is active, this will trigger a success for the test if the door is active and grombo is in the room or if the door is inactive because in that case it wouldn’t matter if grombo was in the room. If the door couldn’t find grombo when the room spawned then the door would not be able to properly use the transport() method and would cause immense issues.
- TopDoorFoundGrombo() – This test makes sure that the top door has found grombo in the scenes that the door is active, this will trigger a success for the test if the door is active and grombo is in the room or if the door is inactive because in that case it wouldn’t matter if grombo was in the room. If the door couldn’t find grombo when the room spawned then the door would not be able to properly use the transport() method and would cause immense issues.
Room Assign Tests:
Room Assign Tests Code
- AssignedBossRoomTest() – This test makes sure that the boss room has spawned in when generating the map. If this test were to fail that would mean the game would have no boss to fight and thus no end.
- AssignedItemRoomTest() – This test makes sure that the shop room has spawned in when generating the map. If this test were to fail, then all of Colton’s feature would not load into the game and Grombo would have no way of increasing his power level to beat the game.
- AssignedStartRoomTest() – This test makes sure that the start room has spawned in when generating the map. If the start room were to not generate and the game was able to run, then most likely grombo would be stranded somewhere with no managers or functionality. This test essentially is a primer to make sure all my other tests are going to be runnable and that the game in fact can start.
Map Tests:
Map Tests Code
- heightCheckTest() – This test makes sure that the height of the map is not 0 or below, if the height were to be below 0 then the dimensions of the grid would not work and the map manager would fail. This would cause the player to be stuck in the initial room with no doors and no hope of ever leaving.
- widthCheckTest() – This test makes sure that the width of the map is not 0 or below, if the width were to be below 0 then the dimensions of the grid would not work and the map manager would fail. This would cause the player to be stuck in the initial room with no doors and no hope of ever leaving.
- startXCheckTest() – This test makes sure that the x value of the starting room in the grid is within the confines of the width of the map. This means that its greater than 0 but less than the maximum width. If the game were to run with the x value of the starting room to be outside of the grid, the doors would not want to active and the player would be stuck in the starting room indefinitely.
- startYCheckTest() – This test makes sure that the y value of the starting room in the grid is within the confines of the height of the map. This means that its greater than 0 but less than the maximum height. If the game were to run with the y value of the starting room to be outside of the grid, the doors would not want to active and the player would be stuck in the starting room indefinitely.
- desiredRoomCountTest() – This test makes sure that the number of rooms that the game generates is greater than 0, if the game tried to run with a desired room count that was too low then the map would not generate properly, probably causing the boss room and shop to spawn irregularly.
Manager Tests:
Manager Tests Code
- gameManagerCheckTest() – This test is quite simple it makes sure that the gameManager is in the starting room scene, without the gameManager the game would not load in any of my partners objects and would not be playable. If the game runs and nothing happens and this test fails that tells me that the game manager or the initial spawns needs to be inputted into the scene.
- mapManagerCheckTest() – This test makes sure that the map manager is spawned in by the game manager, without the map manager generating in the starting room no access to the other rooms would be granted and the game would be unplayable.
- gromboSpawnedCheckTest() – This test makes sure that the player character, Grombo is spawned in by the game manager, without the player character the user would have no way to navigate through the game and interact with the world which would make the game unusable.
- miniMapCheckTest() – This test makes sure that the mini map is spawned in by the game manager, if the mini map doesn’t spawn in then grombo may get lost in the confines of the map. It is also important to have features like this working smoothly for the player to have a proper and fluid gameplay experience.
- ItemPoolSpawnedCheckTest() – This test makes sure that the item pool is spawned in at the beginning of the game. The item pool keeps track of what items have been spawned in and so without it the shop and the merchant mechanic as a whole would not work.
- mapStressTest() – This test makes sure that the game can handle a very large map, it will start with a map of size 20 by 20 and double both dimensions till it reaches 640 by 640, which is a map of 409,600 rooms. If the game can successfully generate the last map then it will not crash and instead return a green check, if the game breaks before that point, then unity will stop working and will have to be shut down with the task manager.
Give an example where a test case later found a bug in your code by things a teammate added later. (Or explain why you chose a test case specifically because you wanted to ensure that a teammate would know if they broke your code.)
My tests often found bugs when I was fixing or adjusting my own work and not my teammates, for example the ____DoorIsWorking() tests would go off when I made a mistake in my programming for any particular door that the compiler didn’t necessarily catch.
gromboSpawnedCheckTest() and ItemPoolSpawnedTest() are both examples of tests that need to pass in order for my teammates to have working features. If the itempool were to not spawn the game would run completely fine till the player tried to purchase something, and then no items would spawn, having a test that makes sure that specific component spawns helps me make sure I am taking care of my partners and making sure I am not the fault in their code not working.