Testing Plan: Combat Manager - UQcsse3200/2024-studio-2 GitHub Wiki

Combat Manager Test Suite

Overview

The Combat Manager is a critical component of the game's battle system, responsible for orchestrating turn-based combat between player and enemy entities. This test suite aims to verify the reliability, accuracy, and performance of all combat-related functionality while ensuring a seamless player experience.

The CombatManager class handles the following core responsibilities:

  1. Combat Flow Management

    • Turn sequence coordination
    • Action selection processing
    • Move execution ordering
    • Combat state management
  2. Stats and Effects Processing

    • Health and stamina calculations
    • Status effect application and duration tracking
    • Multi-hit attack calculations
    • Guard and defense modifications
  3. Special Move Management

    • Enemy move pattern recognition
    • Special move combination tracking
    • Effect trigger management
    • Move history maintenance
  4. Combat Resolution

    • Victory/defeat condition checking
    • Experience and reward calculation
    • Combat state cleanup
    • Game state updates

Combat Manager Test Matrix

Test Category Test Case Input Expected Outcome Validation Method
Basic Combat Actions Player Attack vs Enemy Attack Player selects ATTACK, Enemy selects ATTACK Both entities take damage based on strength/defense stats Health values decrease appropriately
Player Guard vs Enemy Attack Player selects GUARD, Enemy selects ATTACK Player takes reduced damage Player's health decreases by less than a normal attack
Player Sleep vs Enemy Guard Player selects SLEEP, Enemy selects GUARD Player recovers stamina, no damage dealt Player's stamina increases, health unchanged
Status Effects Confusion Effect Player is confused and selects an action Action may be randomly changed Check if action executed matches selected action
Bleeding Effect Player has bleeding status Player takes damage over time Health decreases each turn by correct percentage
Special Moves Enemy Special Move Combination Enemy performs specific move sequence Special move triggers Special effects are applied correctly
Invalid States Null Action Selection Either player or enemy action is null Error logged, turn skipped No crash, appropriate error message
Missing Components Entity missing CombatMoveComponent Error logged, graceful handling No crash, appropriate error message
Edge Cases Zero Health Combat Entity starts with 0 health Combat ends immediately Appropriate end combat event triggered
Maximum Stat Values Stats at maximum possible values Calculations handle large numbers No overflow, correct results
Resource Depletion Zero Stamina Actions Entity attempts action with 0 stamina Appropriate handling/fallback No crash, logical outcome

Performance Metrics

  • Combat round resolution: < 100ms
  • Status effect calculation: < 50ms
  • Move combination execution: < 150ms
  • Combat end check: < 50ms

Quality Metrics

  • Combat system uptime: 99.9%
  • Error recovery rate: 95%
  • Invalid state handling success: 98%
  • Damage calculation precision: 100%
  • Status effect timing accuracy: 100%
  • Move execution order accuracy: 100%

Test Coverage Requirements

  • Line coverage: ≥ 90%
  • Branch coverage: ≥ 85%
  • Function coverage: ≥ 95%
  • Combat combinations tested: 100%
  • Status effect combinations tested: ≥ 90%
  • Enemy type variations tested: 100%

Integration Test Points

  • DialogueBoxService interaction
  • GameState management
  • SaveHandler integration
  • AnimationDisplay synchronization
  • CombatStatsComponent interaction
  • CombatMoveComponent coordination
  • ItemUsageContext handling
  • StatusEffect system integration