Skip to content
This repository has been archived by the owner on Nov 14, 2019. It is now read-only.

Prototype Unit Testing

Harrison Leach edited this page Oct 25, 2019 · 3 revisions

Unit Testing

Throughout the development of our game, care was taken in creating robust modules. This was done by testing the significant modules in unit testing scenarios. During the prototype phase of the project, our team attempted to develop NUnit unit tests. However, we found this would not be feasible as it would be hard to mock out our use of the Unity game engine effectively. Additionally, given the relatively small timeframe of the project and the fact that our team was learning Unity for the first time we thought manual testing would be the best option.

After a module had been completed our group would perform use buttons or inspector properties through the unity editor and/or logging to verify the required functionality of a module. The areas of code that were tested using these unit testing methods are described below.

Queueing Minor Decisions/Cards

An important mechanic of our game is the player interacting with the exclamation mark. This should present a minor decision to the player and wait for their input. The interfacing method for this minor decision functionality was called QueueMinorCard(). In the development of this feature, a test button was added to the world scene to invoke this method. This allowed us to verify the functionality of the minor decision module through the Unity editor in isolation from the other interactive elements in the game. Having the QueueMinorCard() interface method defined early also increased development velocity, as it meant the invoking module (exclamation mark) could be developed in parallel with this knowledge.

Building Animations

An important visual feedback element to our game is the creation of buildings and their animations. The interfacing method that was defined to provide this functionality was the Build() method. A property was placed on the managing game object (SpawnManager) which would invoke this method and it could easily be accessed through the object inspector of Unity This allowed us to quickly verify the element was good enough before being integrated with the decision-making mechanic of the game.