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](#writing-tests) | 3 * [Writing Tests](#writing-tests) |
4 * [Running Tests](#running-tests) | 4 * [Running Tests](#running-tests) |
5 * [Restricting Tests to Certain Platforms](#restricting-tests-to-certain-platf orms) | 5 * [Restricting Tests to Certain Platforms](#restricting-tests-to-certain-platf orms) |
6 * [Platform Selectors](#platform-selectors) | 6 * [Platform Selectors](#platform-selectors) |
7 * [Running Tests on Dartium](#running-tests-on-dartium) | 7 * [Running Tests on Dartium](#running-tests-on-dartium) |
8 * [Asynchronous Tests](#asynchronous-tests) | 8 * [Asynchronous Tests](#asynchronous-tests) |
9 * [Running Tests With Custom HTML](#running-tests-with-custom-html) | 9 * [Running Tests With Custom HTML](#running-tests-with-custom-html) |
10 * [Configuring Tests](#configuring-tests) | 10 * [Configuring Tests](#configuring-tests) |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133  | 133  |
134 | 134 |
135 It's also possible to run a test on the Dart VM only by invoking it using `dart | 135 It's also possible to run a test on the Dart VM only by invoking it using `dart |
136 path/to/test.dart`, but this doesn't load the full test runner and will be | 136 path/to/test.dart`, but this doesn't load the full test runner and will be |
137 missing some features. | 137 missing some features. |
138 | 138 |
139 The test runner considers any file that ends with `_test.dart` to be a test | 139 The test runner considers any file that ends with `_test.dart` to be a test |
140 file. If you don't pass any paths, it will run all the test files in your | 140 file. If you don't pass any paths, it will run all the test files in your |
141 `test/` directory, making it easy to test your entire application at once. | 141 `test/` directory, making it easy to test your entire application at once. |
142 | 142 |
143 You can select specific tests cases to run by name using `pub run test -n "test | |
kevmoo
2016/05/03 21:25:02
Better to use the unabbreviated flag names here –
nweiz
2016/05/03 21:30:34
This is contrary to how we document other flags. I
| |
144 name"`. The string is interpreted as a regular expression, and only tests whose | |
145 description (including any group descriptions) match that regular expression | |
146 will be run. You can also use the `-N` flag to run tests whose names contain a | |
147 plain-text string. | |
148 | |
143 By default, tests are run in the Dart VM, but you can run them in the browser as | 149 By default, tests are run in the Dart VM, but you can run them in the browser as |
144 well by passing `pub run test -p chrome path/to/test.dart`. `test` will take | 150 well by passing `pub run test -p chrome path/to/test.dart`. `test` will take |
145 care of starting the browser and loading the tests, and all the results will be | 151 care of starting the browser and loading the tests, and all the results will be |
146 reported on the command line just like for VM tests. In fact, you can even run | 152 reported on the command line just like for VM tests. In fact, you can even run |
147 tests on both platforms with a single command: `pub run test -p "chrome,vm" | 153 tests on both platforms with a single command: `pub run test -p "chrome,vm" |
148 path/to/test.dart`. | 154 path/to/test.dart`. |
149 | 155 |
150 ### Restricting Tests to Certain Platforms | 156 ### Restricting Tests to Certain Platforms |
151 | 157 |
152 Some test files only make sense to run on particular platforms. They may use | 158 Some test files only make sense to run on particular platforms. They may use |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
652 available to tests. | 658 available to tests. |
653 | 659 |
654 [api]: http://www.dartdocs.org/documentation/test/latest/index.html | 660 [api]: http://www.dartdocs.org/documentation/test/latest/index.html |
655 | 661 |
656 The test runner also supports a machine-readable JSON-based reporter. This | 662 The test runner also supports a machine-readable JSON-based reporter. This |
657 reporter allows the test runner to be wrapped and its progress presented in | 663 reporter allows the test runner to be wrapped and its progress presented in |
658 custom ways (for example, in an IDE). See [the protocol documentation][json] for | 664 custom ways (for example, in an IDE). See [the protocol documentation][json] for |
659 more details. | 665 more details. |
660 | 666 |
661 [json]: https://github.com/dart-lang/test/blob/master/doc/json_reporter.md | 667 [json]: https://github.com/dart-lang/test/blob/master/doc/json_reporter.md |
OLD | NEW |