Map Testing - UQcsse3200/2024-studio-1 GitHub Wiki

Map Testing

There is much difficulty in testing maps and everything to do with it due to needing to have a fully running game to test attributes and unit tests, and this is not viable in most circumstances. Though there has been much effort to test all aspects possible

Tested Classes

MainGameLevelFactoryTest

Tests:

  • Creation of the level
  • Correct type of level
  • Creation of multiple levels

MainGameLevelMapTest

Tests:

  • Get all room connections
  • Get individual connections
  • Get animal index's
  • Get item index's
  • Get player location
  • Get seed
  • Get Map Size

MainGameLevelTest

Tests:

  • Constructor of mocked map and level number on map
  • Get room
  • Get non existent room
  • Get correct start room key
  • Get correct start level number
  • Get correct returned map to mocked map

MinimapTileTest

Tests:

  • Getting set id
  • Get set blend mode that is initially ALPHA
  • Get set texture region that updates accordingly
  • Get offset once set in x
  • Get offset once set in y
  • Get properties as null when initially created
  • Get objects as null when intially created

RoomFactoryTest

Tests:

  • Create room being instance of MainRoom with correct name
  • Create boss room being instance of BossRoom with correct name
  • Create shop room being instance of ShopRoom with correct name
  • Room interface methods on checking whether room is complete or not

TerrainComponentTest

Tests:

  • Tile to world position is correct
  • Tile to world position is correct with grid point 2
  • Get tile size
  • Get map bounds based on layer width and heights
  • Get map where mockmap is same as terrainComponent's map
  • Draw rendering
  • Disposal of terrain Component
  • Get layer

GameAreaTest

Tests:

  • Spawn entity into game area
  • Spawn entity into game area at a particular location
  • Get sound filepaths in game area
  • Get texture atlas filepaths
  • Get texture asset filepaths
  • Get music filepaths

GameControllerTest

Tests:

  • Change rooms and music is played when doing so
  • Update level to changing a level
  • Spawn current room in game area
  • Save map data

MainRoomTest

Tests:

  • Spawn deployable at gridpoint
  • Check room is complete when all enemies are dead
  • All animals are dead when last animal dies
  • Remove room from mainRoom

MapGeneratorTest

Tests:

  • Constructor get expected map size, seed and starting room
  • Create map generates non-empty positions and contains starting room
  • Get positions after creating should not be empty
  • Get room details after creating shouldnt be null or empty
  • Consistent map generation after creating with two different maps with the same seed
  • Different seeds produce different maps
  • Map size affects room count
  • All rooms connected to each other (non-isolated)
  • Room details consistent for each room
  • Supplementary rooms are created and to the number of times specificed in map generator

RandomNumberGeneratorTest

Tests:

  • Get random int within range from random number generator with "testSeed"
  • Throws expection for getting random integer outside range specified
  • Get random double within range from random number generator with "testSeed"
  • Throws expection for getting random double outside range specified

Untested Elements in Classes

Many of the classes that are tested are tested to the best that is capable with the system accessible. With many elements not being mockable, such as room spawning, level changes and how all elements (Entities, Items and Map) interact with each other during these events. Therefore, to confirm the unmockable elements of the game, instead live testing and videoing of the game up until level 2 will be provided, demonstrating the working state of the game

Visual Testing

https://www.youtube.com/watch?v=Z7-EGPRdboA Here is a link of the game as discussed above