Ask your doctor if testing on multiple platforms is right for you

125 views
Skip to first unread message

Natalie Weizenbaum

unread,
Mar 26, 2015, 7:28:43 PM3/26/15
to General Dart Discussion

Hello, Dartisans!


After implementing a test runner and adding browser support, there was only one major component of the basic infrastructure left: specifying which platforms each test supports. Today, I’m happy to announce that this is supported in unittest 0.12.0-beta.0. Here’s what it looks like:


@TestOn("vm")

import 'dart:io';

import 'package:unittest/unittest.dart';

void main() {

 // ...

}


Just put a @TestOn annotation at the top of your file, before and import or library declarations. It takes a string that describes which platform(s) your test supports. The test runner will see this and only load the test on supported platforms.


The string you pass to @TestOn is what we call a platform selector. It can be any of the platforms you pass on the command line (currently just vm or chrome), an operating system name (windows, mac-os, or linux), or a metavariable (posix, js, etc.). It can also contain logical operators for selecting multiple platforms. For a full description of the syntax and the variables you can use, check out the README.


You can also pass platform selectors to the test() and group() functions’ new testOn parameter. These tests and groups will then only run on platforms they support. For example:


test("properly handles Windows path separators", () {

// ...

}, testOn: "windows");


This was the last of the three foundational features we wanted for the new test runner, so the next steps will involve adding a bunch of smaller improvements over the course of several beta releases. We probably won’t be doing email announcements for all of these, so keep an eye on the package page and the issue tracker!


- Natalie

Günter Zöchbauer

unread,
Mar 27, 2015, 2:58:14 AM3/27/15
to mi...@dartlang.org
Sounds great!

George Moschovitis

unread,
Mar 27, 2015, 4:53:01 AM3/27/15
to mi...@dartlang.org

@TestOn("vm")


What about using "cli" instead of "vm"?

Andreas Kirsch

unread,
Mar 27, 2015, 5:47:44 AM3/27/15
to mi...@dartlang.org

cli isn't used anywhere in dart, is it?

On Mar 27, 2015 09:53, "George Moschovitis" <george.mo...@gmail.com> wrote:

@TestOn("vm")


What about using "cli" instead of "vm"?

--
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,
Mar 27, 2015, 4:05:14 PM3/27/15
to General Dart Discussion
My intuition is that "CLI" usually refers specifically to the user interface of a command-line program, whereas we want to refer to the command-line VM specifically. It's true that this is somewhat confusing with Dartium, but in my experience saying "it runs on the VM" or "it's VM-only" is pretty well-understood shorthand in Dart.

On Fri, Mar 27, 2015 at 1:53 AM, George Moschovitis <george.mo...@gmail.com> wrote:

@TestOn("vm")


What about using "cli" instead of "vm"?

--

Yegor Jbanov

unread,
Mar 28, 2015, 2:31:28 AM3/28/15
to mi...@dartlang.org
My intuition is that "CLI" usually refers specifically to the user interface of a command-line program, whereas we want to refer to the command-line VM specifically. It's true that this is somewhat confusing with Dartium, but in my experience saying "it runs on the VM" or "it's VM-only" is pretty well-understood shorthand in Dart.

I think "standalone" is a common way to refer to it.

Reply all
Reply to author
Forward
0 new messages