Taunt System Test Plan Sprint 3 - UQcsse3200/2026-studio-3 GitHub Wiki

Taunt System Test Plan Sprint 3

Scope: Issue #278 — Taunt system and forced targeting

Implementation and tests: commit 1972c062

Integration: Team 1 Sprint 3 PR #374

Purpose

TAUNT lets the Tomb Guardian force the player's single-enemy cards to target a living taunter. It uses the existing enemy DEBUFF and player status-effect systems. The status is stored as TAUNT:<enemy entity ID>, so two enemies can taunt independently. The effect lasts two player turns unless its caster dies first.

This page records the tests added with issue #278 and maps them to its acceptance criteria. It covers the targeting rule and its combat lifecycle, not the optional UI enhancement that would grey out illegal drag targets.

Automated test coverage

Commit 1972c062 added 10 JUnit tests across four existing test classes. Eight directly exercise TAUNT; two check adjacent BattleController state/reset behaviour. The relevant source files are:

Test class New tests What they check
Team3CardPlayAdapterTest 3 Wrong-target rejection before energy/hand changes; valid taunter targets; multiple taunters and death cleanup; SELF and ALL_ENEMIES cards.
BattleControllerTest 5 Living-taunter lookup, caster-ID/value consistency, death cleanup, two-turn expiry, missing player stats, plus two general controller regression checks.
EnemyBehaviourComponentTest 1 The caster applies TAUNT:<caster ID> with its own entity ID as the value and duration 2.
ShieldBreakRetaliationAITest 1 Two normal attacks lead to a two-turn TAUNT intent; shield-break retaliation and armour restoration still take priority.

The two additional controller regression tests are shouldReportWhetherThePlayerCanAct() and shouldResetToSetupAfterTheBattleHasStarted(). They were added in the same commit but should not be counted as direct TAUNT acceptance tests.

Acceptance-criteria traceability

# Required behaviour Automated evidence Result or gap
1 A single-enemy card aimed at a non-taunter is rejected before energy is spent or the card leaves the hand. shouldRejectOtherEnemyDuringTauntWithoutSpendingEnergyOrPlayingTheCard() also checks the battle-log explanation, unchanged enemy health, and no successful-play result event. Covered.
2 ALL_ENEMIES cards still work. shouldAllowSelfAndAllEnemyCardsDuringTaunt() checks that both enemies take damage. Covered.
3 SELF cards still work. The same test checks that Defend plays normally. Covered.
4 A dead taunter stops restricting target selection immediately. shouldAllowEitherTaunterAndOtherEnemiesAfterBothTauntersDie() and shouldAllowAnyLivingTaunterAndRemoveTheDefeatedOne() check cleanup and subsequent targeting. Covered.
5 If Silence and TAUNT are both active, Silence takes precedence. Team3CardPlayAdapter.onCardPlayed() checks Silence before TAUNT, and separate Silence tests exist. Code order verified; no dedicated combined-status JUnit test was found in the issue #278 commit.
6 With several living taunters, any one of them is a legal target. shouldAllowEitherTaunterAndOtherEnemiesAfterBothTauntersDie() plays a card on each taunter. Covered.
7 Duration decreases at player-turn end and the effect disappears at zero. shouldExpireTauntAfterTwoPlayerTurns() checks duration 2 → 1 → removed. Covered.

Additional defensive coverage checks that a status with a mismatched caster ID is ignored and that taunter lookup/death handling remains safe when the player has no CombatStatsComponent.

How to run the tests

Use JDK 21 and run commands from the repository's source directory. On Windows PowerShell:

cd source
.\gradlew.bat :core:test --tests "com.csse3200.game.cards.play.integration.Team3CardPlayAdapterTest" --tests "com.csse3200.game.components.combat.BattleControllerTest" --tests "com.csse3200.game.components.enemy.EnemyBehaviourComponentTest" --tests "com.csse3200.game.components.enemy.EnemyAI.ShieldBreakRetaliationAITest"
.\gradlew.bat test
.\gradlew.bat :core:jacocoTestReport

On macOS/Linux, use ./gradlew in place of .\gradlew.bat. The JaCoCo HTML report is at source/core/build/reports/jacoco/test/html/index.html when viewed from the repository root. The Team 1 test policy targets at least 90% instruction and 80% branch coverage; check the generated report for the affected classes rather than treating a passing test task alone as proof of coverage.

Recorded results and limits

The implementation-time local run recorded 1,377 tests passing with no failures in the Sprint 3 achievement evidence. This page does not attach that local Gradle or JaCoCo output, so regenerate the report when checking a newer branch. For PR #374, the public unit-test CI job and Java-format CI job completed successfully.

The tests confirm the card-play rejection path, not the appearance of drag-target hints. Greying out non-taunting enemies was listed as an optional follow-up in issue #278 and is not claimed here. A dedicated test that activates Silence and TAUNT together remains a useful regression addition. Manual in-game play-test results were not recorded for this page.

⚠️ **GitHub.com Fallback** ⚠️