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

Side by Side Diff: README.md

Issue 1087303004: Add support for user-defined HTML files. (Closed) Base URL: git@github.com:dart-lang/test@master
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/dart.js » ('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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 275
276 stream.listen(expectAsync((number) { 276 stream.listen(expectAsync((number) {
277 expect(number, inInclusiveRange(1, 3)); 277 expect(number, inInclusiveRange(1, 3));
278 }, count: 3)); 278 }, count: 3));
279 }); 279 });
280 } 280 }
281 ``` 281 ```
282 282
283 [expectAsync]: http://www.dartdocs.org/documentation/test/latest/index.html#test /test@id_expectAsync 283 [expectAsync]: http://www.dartdocs.org/documentation/test/latest/index.html#test /test@id_expectAsync
284 284
285 ## Running Tests with Custom HTML
286
287 By default, the test runner will generate its own empty HTML file for browser
288 tests. However, tests that need custom HTML can create their own files. These
289 files have three requirements:
290
291 * They must have the same name as the test, with `.dart` replaced by `.html`.
292
293 * They must contain a `link` tag with `rel="x-dart-test"` and an `href`
294 attribute pointing to the test script.
295
296 * They must contain `<script src="packages/test/dart.js"></script>`.
297
298 For example, if you had a test called `custom_html_test.dart`, you might write
299 the following HTML file:
300
301 ```html
302 <!doctype html>
303 <!-- custom_html_test.html -->
304 <html>
305 <head>
306 <title>Custom HTML Test</title>
307 <link rel="x-dart-test" href="custom_html_test.dart">
308 <script src="packages/test/dart.js"></script>
309 </head>
310 <body>
311 // ...
312 </body>
313 </html>
314 ```
315
285 ## Configuring Tests 316 ## Configuring Tests
286 317
287 ### Timeouts 318 ### Timeouts
288 319
289 By default, tests will time out after 30 seconds of inactivity. However, this 320 By default, tests will time out after 30 seconds of inactivity. However, this
290 can be configured on a per-test, -group, or -suite basis. To change the timeout 321 can be configured on a per-test, -group, or -suite basis. To change the timeout
291 for a test suite, put a `@Timeout` annotation at the top of the file: 322 for a test suite, put a `@Timeout` annotation at the top of the file:
292 323
293 ```dart 324 ```dart
294 @Timeout(new Duration(seconds: 45)) 325 @Timeout(new Duration(seconds: 45))
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 388
358 In this case, the port is `8081`. In another terminal, pass this port to 389 In this case, the port is `8081`. In another terminal, pass this port to
359 `--pub-serve` and otherwise invoke `pub run test:test` as normal: 390 `--pub-serve` and otherwise invoke `pub run test:test` as normal:
360 391
361 ```shell 392 ```shell
362 $ pub run test:test --pub-serve=8081 -p chrome 393 $ pub run test:test --pub-serve=8081 -p chrome
363 "pub serve" is compiling test/my_app_test.dart... 394 "pub serve" is compiling test/my_app_test.dart...
364 "pub serve" is compiling test/utils_test.dart... 395 "pub serve" is compiling test/utils_test.dart...
365 00:00 +42: All tests passed! 396 00:00 +42: All tests passed!
366 ``` 397 ```
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | lib/dart.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698