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

Side by Side Diff: README.md

Issue 1096693005: Support @Skip as a suite-level annotation. (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/src/frontend/skip.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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 <script src="packages/test/dart.js"></script> 308 <script src="packages/test/dart.js"></script>
309 </head> 309 </head>
310 <body> 310 <body>
311 // ... 311 // ...
312 </body> 312 </body>
313 </html> 313 </html>
314 ``` 314 ```
315 315
316 ## Configuring Tests 316 ## Configuring Tests
317 317
318 ### Skipping Tests
319
320 If a test, group, or entire suite isn't working yet and you just want it to stop
321 complaining, you can mark it as "skipped". The test or tests won't be run, and,
322 if you supply a reason why, that reason will be printed. In general, skipping
323 tests indicates that they should run but is temporarily not working. If they're
324 is fundamentally incompatible with a platform, [`@TestOn`/`testOn`][TestOn]
325 should be used instead.
326
327 [TestOn]: #restricting-tests-to-certain-platforms
328
329 To skip a test suite, put a `@Skip` annotation at the top of the file:
330
331 ```dart
332 @Skip("currently failing (see issue 1234)")
333
334 import "package:test/test.dart";
335
336 void main() {
337 // ...
338 }
339 ```
340
341 The string you pass should describe why the test is skipped. You don't have to
342 include it, but it's a good idea to document why the test isn't running.
343
344 Groups and individual tests can be skipped by passing the `skip` parameter. This
345 can be either `true` or a String describing why the test is skipped. For example :
346
347 ```dart
348 import "package:test/test.dart";
349
350 void main() {
351 group("complicated algorithm tests", () {
352 // ...
353 }, skip: "the algorithm isn't quite right");
354
355 test("error-checking test", () {
356 // ...
357 }, skip: "TODO: add error-checking.");
358 }
359 ```
360
318 ### Timeouts 361 ### Timeouts
319 362
320 By default, tests will time out after 30 seconds of inactivity. However, this 363 By default, tests will time out after 30 seconds of inactivity. However, this
321 can be configured on a per-test, -group, or -suite basis. To change the timeout 364 can be configured on a per-test, -group, or -suite basis. To change the timeout
322 for a test suite, put a `@Timeout` annotation at the top of the file: 365 for a test suite, put a `@Timeout` annotation at the top of the file:
323 366
324 ```dart 367 ```dart
325 @Timeout(new Duration(seconds: 45)) 368 @Timeout(new Duration(seconds: 45))
326 369
327 import "package:test/test.dart"; 370 import "package:test/test.dart";
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 431
389 In this case, the port is `8081`. In another terminal, pass this port to 432 In this case, the port is `8081`. In another terminal, pass this port to
390 `--pub-serve` and otherwise invoke `pub run test:test` as normal: 433 `--pub-serve` and otherwise invoke `pub run test:test` as normal:
391 434
392 ```shell 435 ```shell
393 $ pub run test:test --pub-serve=8081 -p chrome 436 $ pub run test:test --pub-serve=8081 -p chrome
394 "pub serve" is compiling test/my_app_test.dart... 437 "pub serve" is compiling test/my_app_test.dart...
395 "pub serve" is compiling test/utils_test.dart... 438 "pub serve" is compiling test/utils_test.dart...
396 00:00 +42: All tests passed! 439 00:00 +42: All tests passed!
397 ``` 440 ```
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/frontend/skip.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698