Testing Plan for DayNight cycle - UQcsse3200/2024-studio-3 GitHub Wiki
DayNightService Test Plan and JUnit Tests
Purpose
Writing JUnit tests DayNightServiceTest.java
for ensuring that events are triggered from the DayNightService
to
- properly dispose orders at the end of the day.
- trigger the transition cycle between the
GameScreen
,EndDayDisplay
, andMoralDisplay
and to ensure DayNightService
properly handles incoming event triggers when moral decisions have been made and animations are done.
What wasn't tested:
Although we set up the the displays and other components and files to appropriately handle the day cycle, we do not take ownership that those dependencies (MainGameOrderTicketDisplay.java
, EndDayDisplay.java
, MoralDecisionDisplay.java
, PlayerStatsDisplay
, and more) are working properly, or at least not in this test. We ensure that our service is properly consuming incoming events and trigger events for transitions at the right time.
In Game Testing and Visual Confirmation:
It is easy to test and visually confirm that DayNightService is properly handling its role:
- In
DayNightService.java
adjust the five minutes condition to 10 seconds or so. - Remove the handling of the "endGame" event imposed by team 6 to end that game at the end of the first day.
- Visually confirm that the game automatically transitions to the
EndDayDisplay
after 10 seconds. - Visually confirm that you transition to
MoralDecisionDisplay
when you closeEndDayDisplay
. - Visually confirm that you transition back to the
MainGameScreen
when you closeMoralDecisionDisplay
. - Visually see how the day and timer information updates in the
MainGameScreen
.
Setup
There are 2 test methods. Since the instantiation of dependencies for the different tests vary and are a bit complex conceptually, I refrained from refactoring the test file with a setup method that runs before each test. Plus it doesn't make much sense when only 2 methods are involved.
Expected Outcome
Verifies that DayNightService
successfully handles the event triggers and listeners to appropriately handle the day cycle transitions between the main game screen, end day display, moral decision display, and clear orders at the end of the day. It also ensure the "newday" event appropriately results in the day increments on the main game screen and displays a timer prior to the day ending.