9:15am 7 Feb, 2014 These changes have not been released to the pub site yet.

tl;dr
  • If you're testing code using Future, Stream, or anything async, you'll notice a lot fewer crashes and a lot more helpful stack traces.
  • If you're subclassing Configuration, keep reading.
  • If you're using APIs on TestCase, keep reading.
  • If you're just using test, group, expect, etc. you're likely fine.
  • Update pub dependencies on unittest to includes 0.10.0 to get the new hotness. (You might have something like >=0.9.0 < 0.10.0, change it to >=0.9.0 <0.11.0)
The upcoming 0.10.0 release of unittest will have a lot of changes. Here's a copy-paste of the current changelog.
  • Each test is run in a separate Zone. This ensures that any exceptions that occur is async operations are reported back to the source test case.
  • DEPRECATED guardAsync, protectAsync0, protectAsync1, and protectAsync2
    • Running each test in a Zone addresses the need for these methods.
  • TestCase:
    • Removed properties: setUp, tearDown, testFunction
    • enabled is now get-only
    • Removed methods: pass, fail, error
  • interactive_html_config.dart has been removed.
  • runTests, tearDown, setUp, test, group, solo_test, and solo_group now throw a StateError if called while tests are running.
  • rerunTests has been removed.
These changes cover three big areas:
  • Remove unsupported APIs. The interactive test case runner hadn't been touched in a long time and it didn't support a number core test case features, like setUp and TearDown. The rerunTests function only existed to support the interactive runner and introduce a lot of weird state in unittest.
  • Make TestCase immutable. Expect more changes here. TestCase should contain the logic to run the test. The result of the run should be in another object. We're getting there.
  • Make testing async code easier. All tests are now run in a Zone. This means all any errors thrown by async operations are now funneled to the calling test case without requiring guardAsync or a protectAsyncN function (these are now deprecated).
Going forward, we're looking into more changes:
  • Remove more state from TestCase. enabled, isComplete, passed, and startTime may be removed from this class and exposed somewhere else.
  • I'm hoping to have a model where TestCase exposes Future<TestResult> run([Configuration config]) or similar.
  • More powerful ways to run unit tests, making it easy to run tests is parallel in zones, for example.
I'd like unittest to evolve to expose a very simple API that others can build on, with a layer of "easy" for those that just want to get something tested without a lot of ceremony.

Your thoughts and suggestions are welcome!

Happy hacking.