UGS Class Testing - UQdeco2800/2022-studio-1 GitHub Wiki

Feedback from Sprints 1-2

Based off of feedback received from sprints 1-2, the following ideas were integrated into the UGS:

  • Creating a unified grid positioning system which maintains the state of all entities and map layouts
  • Creating a snappable grid layout (i.e. if users click anywhere within a grid tile, the building is built in the centre of the tile)
  • Creating methods to allow easy utilisation of UGS features

Introduction

In accordance with the Test Plan tests were written for the UGS and the Tile classes.

Tests

UGSTest

Requirement Test case addressed by
Test a UGS can be correctly created shouldCreateUGS
Test a coordinate can be correctly generated shouldGenerateCoordinate
Tests that a Tile can be added to the UGS, and that the UGS returns correct result given a coordinate testReturnSmallHashmap
Tests a Tile within the UGS can be updated testSetTileType
Tests a Tile within the UGS can be updated to contain a new entity testSetEntity
Tests the UGS returns the correct tileType given it contains multiple tiles testReturnMultipleTiles
Tests the return value of the UGS is independent of the input testReturnGeneratedTiles
Tests the UGS can be updated with a large entity TestSetLargeEntity
Tests an entity can be returned by coordinate testGetEntity
Tests an entity can be returned by string testGetNamedEntity
Tests an entity can be removed from the UGS testRemoveEntity

TileTest

Requirement Test case addressed by
Test the no-parameter constructor works correctly testConstructorNoParams
Test the constructor which only takes an entity works correctly testConstructorEntity
Test the constructor which only takes a tileType works correctly testConstructorTileType
Test the setters work correctly testSetters

Future Updates

In the future, the team will need to expand upon tests for all classes to ensure test coverage is as high as possible.