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

Side by Side Diff: README.md

Issue 1085643002: Update the README and test2.gif. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: 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 | « no previous file | image/test2.gif » ('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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 }); 73 });
74 } 74 }
75 ``` 75 ```
76 76
77 ## Running Tests 77 ## Running Tests
78 78
79 A single test file can be run just using `dart path/to/test.dart`. 79 A single test file can be run just using `dart path/to/test.dart`.
80 80
81 ![Tests being run via "dart path/to/test.dart".](https://raw.githubusercontent.c om/dart-lang/test/master/image/test1.gif) 81 ![Tests being run via "dart path/to/test.dart".](https://raw.githubusercontent.c om/dart-lang/test/master/image/test1.gif)
82 82
83 Many tests can be run at a time using `pub run test:test path/to/dir`. 83 Many tests can be run at a time using `pub run test:test path/to/dir` (on Dart
84 1.10, this can be shortened to `pub run test path/to/dir`).
84 85
85 ![Directory being run via "pub run".](https://raw.githubusercontent.com/dart-lan g/test/master/image/test2.gif) 86 ![Directory being run via "pub run".](https://raw.githubusercontent.com/dart-lan g/test/master/image/test2.gif)
86 87
87 `test` considers any file that ends with `_test.dart` to be a test file. If 88 `test` considers any file that ends with `_test.dart` to be a test file. If
88 you don't pass any paths, it will run all the test files in your `test/` 89 you don't pass any paths, it will run all the test files in your `test/`
89 directory, making it easy to test your entire application at once. 90 directory, making it easy to test your entire application at once.
90 91
91 By default, tests are run in the Dart VM, but you can run them in the browser as 92 By default, tests are run in the Dart VM, but you can run them in the browser as
92 well by passing `pub run test:test -p chrome path/to/test.dart`. 93 well by passing `pub run test:test -p chrome path/to/test.dart`.
93 `test` will take care of starting the browser and loading the tests, and all 94 `test` will take care of starting the browser and loading the tests, and all
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 Platform selectors can contain identifiers, parentheses, and operators. When 129 Platform selectors can contain identifiers, parentheses, and operators. When
129 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
130 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`.
131 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
132 valid identifiers are: 133 valid identifiers are:
133 134
134 * `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.
135 136
136 * `chrome`: Whether the test is running on Google Chrome. 137 * `chrome`: Whether the test is running on Google Chrome.
137 138
139 * `firefox`: Whether the test is running on Mozilla Firefox.
140
138 * `dart-vm`: Whether the test is running on the Dart VM in any context. For now 141 * `dart-vm`: Whether the test is running on the Dart VM in any context. For now
139 this is identical to `vm`, but it will also be true for Dartium in the future. 142 this is identical to `vm`, but it will also be true for Dartium in the future.
140 It's identical to `!js`. 143 It's identical to `!js`.
141 144
142 * `browser`: Whether the test is running in any browser. 145 * `browser`: Whether the test is running in any browser.
143 146
144 * `js`: Whether the test has been compiled to JS. This is identical to 147 * `js`: Whether the test has been compiled to JS. This is identical to
145 `!dart-vm`. 148 `!dart-vm`.
146 149
147 * `blink`: Whether the test is running in a browser that uses the Blink 150 * `blink`: Whether the test is running in a browser that uses the Blink
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 ```shell 273 ```shell
271 $ pub serve 274 $ pub serve
272 Loading source assets... 275 Loading source assets...
273 Loading test/pub_serve transformers... 276 Loading test/pub_serve transformers...
274 Serving my_app web on http://localhost:8080 277 Serving my_app web on http://localhost:8080
275 Serving my_app test on http://localhost:8081 278 Serving my_app test on http://localhost:8081
276 Build completed successfully 279 Build completed successfully
277 ``` 280 ```
278 281
279 In this case, the port is `8081`. In another terminal, pass this port to 282 In this case, the port is `8081`. In another terminal, pass this port to
280 `--pub-serve` and otherwise invoke `pub run test` as normal: 283 `--pub-serve` and otherwise invoke `pub run test:test` as normal:
281 284
282 ```shell 285 ```shell
283 $ pub run test --pub-serve=8081 -p chrome 286 $ pub run test:test --pub-serve=8081 -p chrome
284 "pub serve" is compiling test/my_app_test.dart... 287 "pub serve" is compiling test/my_app_test.dart...
285 "pub serve" is compiling test/utils_test.dart... 288 "pub serve" is compiling test/utils_test.dart...
286 00:00 +42: All tests passed! 289 00:00 +42: All tests passed!
287 ``` 290 ```
OLDNEW
« no previous file with comments | « no previous file | image/test2.gif » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698