question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unit Testing Framework enhancements

See original GitHub issue

There’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:open
  • Created 6 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
Simowncommented, Apr 26, 2017

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.

1reaction
Simowncommented, May 6, 2017

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Keys to Successful Unit Testing - Software Testing Help
Unit testing is the method of verifying smallest piece of testable code against its purpose. Here are some tips to write good unit...
Read more >
Chapter 1. Unit Test Frameworks: An Overview
Developers who use test-centric development report dramatic improvements in software quality, speed of development, and ability to make significant design ...
Read more >
Unit Testing Tutorial – What is, Types & Test Example - Guru99
In case of any enhancements or change in requirements, unit test cases should not be affected. Test only one code at a time....
Read more >
How to Choose the Best Unit Testing Framework for JavaScript
The best unit testing framework for JavaScript: Jest, Cypress, Storybook, Puppeteer, Mocha, AVA. This guide explains how to make the right ...
Read more >
A Deep Dive into Unit Testing - Semaphore CI
Learn how unit testing can help you improve code quality and speed up ... Some authors have proposed enhancements for the formula.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found