Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: README.md

Issue 1080103002: Add support for running tests on Dartium. (Closed) Base URL: git@github.com:dart-lang/test@wip.dartium
Patch Set: Code review changes Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/backend/test_platform.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 `test` provides a standard way of writing and running tests in Dart. 1 `test` provides a standard way of writing and running tests in Dart.
2 2
3 ## Writing Tests 3 ## Writing Tests
4 4
5 Tests are specified using the top-level [`test()`][test] function, and test 5 Tests are specified using the top-level [`test()`][test] function, and test
6 assertions are made using [`expect()`][expect]: 6 assertions are made using [`expect()`][expect]:
7 7
8 [test]: http://www.dartdocs.org/documentation/test/latest/index.html#test/test@i d_test 8 [test]: http://www.dartdocs.org/documentation/test/latest/index.html#test/test@i d_test
9 [expect]: http://www.dartdocs.org/documentation/test/latest/index.html#test/test @id_expect 9 [expect]: http://www.dartdocs.org/documentation/test/latest/index.html#test/test @id_expect
10 10
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 ### Platform Selector Syntax 127 ### Platform Selector Syntax
128 128
129 Platform selectors can contain identifiers, parentheses, and operators. When 129 Platform selectors can contain identifiers, parentheses, and operators. When
130 loading a test, each identifier is set to `true` or `false` based on the current 130 loading a test, each identifier is set to `true` or `false` based on the current
131 platform, and the test is only loaded if the platform selector returns `true`. 131 platform, and the test is only loaded if the platform selector returns `true`.
132 The operators `||`, `&&`, `!`, and `? :` all work just like they do in Dart. The 132 The operators `||`, `&&`, `!`, and `? :` all work just like they do in Dart. The
133 valid identifiers are: 133 valid identifiers are:
134 134
135 * `vm`: Whether the test is running on the command-line Dart VM. 135 * `vm`: Whether the test is running on the command-line Dart VM.
136 136
137 * `dartium`: Whether the test is running on Dartium.
138
137 * `chrome`: Whether the test is running on Google Chrome. 139 * `chrome`: Whether the test is running on Google Chrome.
138 140
139 * `firefox`: Whether the test is running on Mozilla Firefox. 141 * `dart-vm`: Whether the test is running on the Dart VM in any context,
140 142 including Dartium. It's identical to `!js`.
141 * `dart-vm`: Whether the test is running on the Dart VM in any context. For now
142 this is identical to `vm`, but it will also be true for Dartium in the future.
143 It's identical to `!js`.
144 143
145 * `browser`: Whether the test is running in any browser. 144 * `browser`: Whether the test is running in any browser.
146 145
147 * `js`: Whether the test has been compiled to JS. This is identical to 146 * `js`: Whether the test has been compiled to JS. This is identical to
148 `!dart-vm`. 147 `!dart-vm`.
149 148
150 * `blink`: Whether the test is running in a browser that uses the Blink 149 * `blink`: Whether the test is running in a browser that uses the Blink
151 rendering engine. 150 rendering engine.
152 151
153 * `windows`: Whether the test is running on Windows. If `vm` is false, this will 152 * `windows`: Whether the test is running on Windows. If `vm` is false, this will
154 be `false` as well. 153 be `false` as well.
155 154
156 * `mac-os`: Whether the test is running on Mac OS. If `vm` is false, this will 155 * `mac-os`: Whether the test is running on Mac OS. If `vm` is false, this will
157 be `false` as well. 156 be `false` as well.
158 157
159 * `linux`: Whether the test is running on Linux. If `vm` is false, this will be 158 * `linux`: Whether the test is running on Linux. If `vm` is false, this will be
160 `false` as well. 159 `false` as well.
161 160
162 * `android`: Whether the test is running on Android. If `vm` is false, this will 161 * `android`: Whether the test is running on Android. If `vm` is false, this will
163 be `false` as well, which means that this *won't* be true if the test is 162 be `false` as well, which means that this *won't* be true if the test is
164 running on an Android browser. 163 running on an Android browser.
165 164
166 * `posix`: Whether the test is running on a POSIX operating system. This is 165 * `posix`: Whether the test is running on a POSIX operating system. This is
167 equivalent to `!windows`. 166 equivalent to `!windows`.
168 167
169 For example, if you wanted to run a test on every browser but Chrome, you would 168 For example, if you wanted to run a test on every browser but Chrome, you would
170 write `@TestOn("browser && !chrome")`. 169 write `@TestOn("browser && !chrome")`.
171 170
171 ### Running Tests on Dartium
172
173 Tests can be run on [Dartium][] by passing the `-p dartium` flag. If you're
174 using the Dart Editor, the test runner will be able to find Dartium
175 automatically. However, since it usually isn't installed on a system-wide basis,
176 the test runner may not otherwise be able to find the Dartium executable. To use
177 it without the Editor, make sure there's an executable called `dartium` (on Mac
178 OS or Linux) or `dartium.exe` (on Windows) on your system path.
179
180 [Dartium]: https://www.dartlang.org/tools/dartium/
181
182 [In the future][issue 63], there will be a more explicit way to configure the
183 location of the executable.
184
185 [issue 63]: https://github.com/dart-lang/test/issues/63
186
172 ## Asynchronous Tests 187 ## Asynchronous Tests
173 188
174 Tests written with `async`/`await` will work automatically. The test runner 189 Tests written with `async`/`await` will work automatically. The test runner
175 won't consider the test finished until the returned `Future` completes. 190 won't consider the test finished until the returned `Future` completes.
176 191
177 ```dart 192 ```dart
178 import "dart:async"; 193 import "dart:async";
179 194
180 import "package:test/test.dart"; 195 import "package:test/test.dart";
181 196
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 296
282 In this case, the port is `8081`. In another terminal, pass this port to 297 In this case, the port is `8081`. In another terminal, pass this port to
283 `--pub-serve` and otherwise invoke `pub run test:test` as normal: 298 `--pub-serve` and otherwise invoke `pub run test:test` as normal:
284 299
285 ```shell 300 ```shell
286 $ pub run test:test --pub-serve=8081 -p chrome 301 $ pub run test:test --pub-serve=8081 -p chrome
287 "pub serve" is compiling test/my_app_test.dart... 302 "pub serve" is compiling test/my_app_test.dart...
288 "pub serve" is compiling test/utils_test.dart... 303 "pub serve" is compiling test/utils_test.dart...
289 00:00 +42: All tests passed! 304 00:00 +42: All tests passed!
290 ``` 305 ```
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/backend/test_platform.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698