The unittest of Tomorrow, Today!

118 views
Skip to first unread message

Natalie Weizenbaum

unread,
Feb 19, 2015, 7:46:36 PM2/19/15
to General Dart Discussion

Hello, Dartisans!


Kevin and I have been hard at work on a test runner for unittest, and today we’re excited to release the first product of that work. Just add unittest 0.12.0-alpha.0 as a dependency to your project:


dependency_overrides:

 unittest: ^0.12.0-alpha.0


and run pub run unittest:unittest. If everything works out, it’ll run all your tests—that is, everything recursively in the test/ directory that ends with _test.dart. Nifty!


There are some caveats, though. This is our very first working draft—the simplest thing that could possibly work. It’s by no means finished, and while we don’t know of any bugs, there are a lot of things it just doesn’t support yet. In particular:

That said, if these caveats don’t bother you, please try it out! If you find any issues, file them on the GitHub repo. If you’re curious about the general direction, go ahead and reply to this email.

- Natalie



Bob Nystrom

unread,
Feb 19, 2015, 7:54:29 PM2/19/15
to General Dart Discussion

On Thu, Feb 19, 2015 at 4:46 PM, 'Natalie Weizenbaum' via Dart Misc <mi...@dartlang.org> wrote:

dependency_overrides:

 unittest: ^0.12.0-alpha.0


Should this be dev_dependencies?

- bob

Kevin Moore

unread,
Feb 19, 2015, 11:01:09 PM2/19/15
to mi...@dartlang.org
dev_dependencies is fine.

If you want to see a working example, take a look at the matcher package - https://github.com/dart-lang/matcher

 - sync the source
 - pub install
 - pub run unittest:unittest

Just don't blink – the tests finish REALLY fast

Kevin Moore

unread,
Feb 19, 2015, 11:38:07 PM2/19/15
to mi...@dartlang.org
If you have issues running it on 1.8, try it on Dart 1.9 dev.

Anders Holmgren

unread,
Feb 20, 2015, 1:03:30 AM2/20/15
to mi...@dartlang.org
This is great news. Very much looking forward to not having to maintain all_test files. Will this work at any level? For example if I wanna run only tests at test/foo/bar?

Natalie Weizenbaum

unread,
Feb 20, 2015, 3:15:59 AM2/20/15
to General Dart Discussion
You could use dev_dependencies, but dependency_overrides makes it easy to drop in to a package for a bit to play with and then remove later. I don't know that it's in good enough shape right now to be the canonical way for a project to run its tests.

--
For other discussions, see https://groups.google.com/a/dartlang.org/
 
For HOWTO questions, visit http://stackoverflow.com/tags/dart
 
To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.

Natalie Weizenbaum

unread,
Feb 20, 2015, 3:16:51 AM2/20/15
to General Dart Discussion
You can run it with a custom file or directory right now; e.g. pub run unittest:unittest test/foo/bar. In the future we'd like to have some sort of configuration file where you can set the default too.

On Thu, Feb 19, 2015 at 10:03 PM, Anders Holmgren <andersm...@gmail.com> wrote:
This is great news. Very much looking forward to not having to maintain all_test files. Will this work at any level? For example if I wanna run only tests at test/foo/bar?
Reply all
Reply to author
Forward
0 new messages