Unit Testing Framework enhancements
See original GitHub issueThere’s a few known issues in XMage’s UT framework that prevent some cards from being testable. I’ll continue to add them here as tasks to complete.
-
Handling for creature able to block multiple creatures (ex WatcherInTheWeb)
-
A wide variety of targetting issues (see RealitySmasherTest) - seems to be related to the UT framework having separate handling for targetting that does not always match in game.
-
Ability to force how the mana is tapped for casting spells / activating abilities (ex. casting multiple spells in the same turn requiring specific mana costs can sometimes fail due to not having the right mana available to use it)
-
Handling to differentiate between cards with the same name, i.e. a creature named Nacatl War-Pride vs the token that is a copy of itself named Nacatl War-Pride (ex. be able to block the actual creature instead of the token)
-
Some abilities such as Prowl do not seem to be supported. See
ProwlTest -
Illegal moves that would not be permitted in a game fail silently such as declaring illegal blockers or attacking with summoning sick creatures
-
Casting a spell without mana available will fail silently and not cause the unit test to fail
-
A permanent can only be targeted once by multi-target spells and abilities regardless if they can be targeted multiple times
-
Number of targets a spell has isn’t enforced. The wrong number of targets will either cause the spell not to be cast or ignore extra targets.
-
We can’t differentiate between attacking (illegally) multiple times each combat and attacking over multiple combat stages on the same turn.
(feel free to add more issues you’ve noticed from using the UT framework)
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (13 by maintainers)

Top Related StackOverflow Question
Updated the list.
Nearly finished the work on handling multiple targets - creatures are indexed as to when they entered the battlefield and can be accessed “Creature:0”, “Creature:1” etc. Creature 0 can always be selected using “Creature” (without an index).
Need to do a bit of tidying up and fix up some unit tests that try to run tests with illegal moves in them.
Can differentiate between permanents you control now in the tests: da3a3ec8758c5e62107bc17cb624669416ef9e80
Blockers are validated and summoning sick creatures can no longer attack. Attackers still need work which is covered by the most recent checkbox.