Sprint 4 terrain test - UQdeco2800/2021-ext-studio-2 GitHub Wiki
Magma and nails test
Testing the SpawnMagma() and SpawnNails(), whether the magma and nails can be generated successfully.
@Test
void shouldSpawnMagma() {
GameArea gameArea =
new GameArea() {
@Override
public void create() {}
};
ServiceLocator.registerPhysicsService(new PhysicsService());
ServiceLocator.registerEntityService(new EntityService());
ServiceLocator.registerRenderService(new RenderService());
ResourceService resourceService = new ResourceService();
resourceService.loadTextures(forestTextures);
resourceService.loadAll();
ServiceLocator.registerResourceService(resourceService);
Entity MagmaMock = mock(ObstacleFactory.createWood().getClass());
gameArea.spawnEntity(MagmaMock);
verify(MagmaMock).create();
gameArea.dispose();
verify(MagmaMock).dispose();
}
@Test
void shouldSpawnNails() {
GameArea gameArea =
new GameArea() {
@Override
public void create() {}
};
ServiceLocator.registerPhysicsService(new PhysicsService());
ServiceLocator.registerEntityService(new EntityService());
ServiceLocator.registerRenderService(new RenderService());
ResourceService resourceService = new ResourceService();
resourceService.loadTextures(forestTextures);
resourceService.loadAll();
ServiceLocator.registerResourceService(resourceService);
Entity NailsMock = mock(ObstacleFactory.createWood().getClass());
gameArea.spawnEntity(NailsMock);
verify(NailsMock).create();
gameArea.dispose();
verify(NailsMock).dispose();
}
Testings for UI
- Checkout the attack values while playing the game
- User testings for the terrain layout and check whether the player will be stuck between the rocks and woods
- Check the game over screen while the character is dead