Skip to content

AssetConfig Test Plan

McArthur edited this page Oct 5, 2023 · 2 revisions

These tests are for the AssetConfig class. The AssetConfig class is a configuration class which stores the paths of all assets to be loaded in to the game. Because it uses the FileLoader and ConfigLoader, mock testing was utilized. Additionally, assertions are used to ensure correct loading.

Setup

To test the config loader, the following static classes had to be mocked:

  • LoadUtils
  • FileLoader

Additionally, before each test, several variables needed to be set up to track:

  • assetsConfig (the asset config being tested)
  • assetManager (this uses a mockito spy as it is an external dependency that needs to function mostly but still be mocked)
  • resourceService (a resource service using the asset manager)

Teardown

utilsMock and fileLoaderMock need to be closed as they are mocking static classes, to avoid leakage.

Tests

  • loadAndUnloadTexturePaths()
    • This verifies that the asset manager can correctly load png files for textures, and unload them.
  • loadAndUnloadTextureAtlasPaths()
    • This verifies that the asset manager can correctly load atlas files and unload them.
  • loadAndUnloadSoundEffects()
    • This verifies the asset manager can successfully load and unload wave and ogg files.
  • loadAndUnloadParticleEffects()
    • This verifies the asset manager can successfully load and unload .effect files
  • loadAndUnloadBackgroundMusic()
    • This verifies the manager can successfully load and unload .wav files for background music
Clone this wiki locally