OLD | NEW |
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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 | 438 |
439 If multiple platforms match, the configuration is applied in order from first to | 439 If multiple platforms match, the configuration is applied in order from first to |
440 last, just as they would in nested groups. This means that for configuration | 440 last, just as they would in nested groups. This means that for configuration |
441 like duration-based timeouts, the last matching value wins. | 441 like duration-based timeouts, the last matching value wins. |
442 | 442 |
443 ## Testing With `barback` | 443 ## Testing With `barback` |
444 | 444 |
445 Packages using the `barback` transformer system may need to test code that's | 445 Packages using the `barback` transformer system may need to test code that's |
446 created or modified using transformers. The test runner handles this using the | 446 created or modified using transformers. The test runner handles this using the |
447 `--pub-serve` option, which tells it to load the test code from a `pub serve` | 447 `--pub-serve` option, which tells it to load the test code from a `pub serve` |
448 instance rather than from the filesystem. **This feature is only supported on | 448 instance rather than from the filesystem. |
449 Dart `1.9.2` and higher.** | |
450 | 449 |
451 Before using the `--pub-serve` option, add the `test/pub_serve` transformer to | 450 Before using the `--pub-serve` option, add the `test/pub_serve` transformer to |
452 your `pubspec.yaml`. This transformer adds the necessary bootstrapping code that | 451 your `pubspec.yaml`. This transformer adds the necessary bootstrapping code that |
453 allows the test runner to load your tests properly: | 452 allows the test runner to load your tests properly: |
454 | 453 |
455 ```yaml | 454 ```yaml |
456 transformers: | 455 transformers: |
457 - test/pub_serve: | 456 - test/pub_serve: |
458 $include: test/**_test{.*,}.dart | 457 $include: test/**_test{.*,}.dart |
459 ``` | 458 ``` |
(...skipping 25 matching lines...) Expand all Loading... |
485 | 484 |
486 In this case, the port is `8081`. In another terminal, pass this port to | 485 In this case, the port is `8081`. In another terminal, pass this port to |
487 `--pub-serve` and otherwise invoke `pub run test:test` as normal: | 486 `--pub-serve` and otherwise invoke `pub run test:test` as normal: |
488 | 487 |
489 ```shell | 488 ```shell |
490 $ pub run test:test --pub-serve=8081 -p chrome | 489 $ pub run test:test --pub-serve=8081 -p chrome |
491 "pub serve" is compiling test/my_app_test.dart... | 490 "pub serve" is compiling test/my_app_test.dart... |
492 "pub serve" is compiling test/utils_test.dart... | 491 "pub serve" is compiling test/utils_test.dart... |
493 00:00 +42: All tests passed! | 492 00:00 +42: All tests passed! |
494 ``` | 493 ``` |
OLD | NEW |