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

Side by Side Diff: README.md

Issue 1097113004: Discourage users from running "dart path/to/file". (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/test1.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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 contains("foo"), 69 contains("foo"),
70 isNot(startsWith("bar")), 70 isNot(startsWith("bar")),
71 endsWith("baz") 71 endsWith("baz")
72 ])); 72 ]));
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 `pub run test:test path/to/test.dart`
80 (on Dart 1.10, this can be shortened to `pub run test path/to/test.dart`).
80 81
81 ![Tests being run via "dart path/to/test.dart".](https://raw.githubusercontent.c om/dart-lang/test/master/image/test1.gif) 82 ![Single file being run via pub run"](https://raw.githubusercontent.com/dart-lan g/test/master/image/test1.gif)
82 83
83 Many tests can be run at a time using `pub run test:test path/to/dir` (on Dart 84 Many tests can be run at a time using `pub run test:test path/to/dir`.
84 1.10, this can be shortened to `pub run test path/to/dir`).
85 85
86 ![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)
87 87
88 `test` considers any file that ends with `_test.dart` to be a test file. If 88 It's also possible to run a test on the Dart VM only by invoking it using `dart
89 you don't pass any paths, it will run all the test files in your `test/` 89 path/to/test.dart`, but this doesn't load the full test runner and will be
90 directory, making it easy to test your entire application at once. 90 missing some features.
91
92 The test runner considers any file that ends with `_test.dart` to be a test
93 file. If you don't pass any paths, it will run all the test files in your
94 `test/` directory, making it easy to test your entire application at once.
91 95
92 By default, tests are run in the Dart VM, but you can run them in the browser as 96 By default, tests are run in the Dart VM, but you can run them in the browser as
93 well by passing `pub run test:test -p chrome path/to/test.dart`. 97 well by passing `pub run test:test -p chrome path/to/test.dart`.
94 `test` will take care of starting the browser and loading the tests, and all 98 `test` will take care of starting the browser and loading the tests, and all
95 the results will be reported on the command line just like for VM tests. In 99 the results will be reported on the command line just like for VM tests. In
96 fact, you can even run tests on both platforms with a single command: `pub run 100 fact, you can even run tests on both platforms with a single command: `pub run
97 test:test -p chrome -p vm path/to/test.dart`. 101 test:test -p chrome -p vm path/to/test.dart`.
98 102
99 ### Restricting Tests to Certain Platforms 103 ### Restricting Tests to Certain Platforms
100 104
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 435
432 In this case, the port is `8081`. In another terminal, pass this port to 436 In this case, the port is `8081`. In another terminal, pass this port to
433 `--pub-serve` and otherwise invoke `pub run test:test` as normal: 437 `--pub-serve` and otherwise invoke `pub run test:test` as normal:
434 438
435 ```shell 439 ```shell
436 $ pub run test:test --pub-serve=8081 -p chrome 440 $ pub run test:test --pub-serve=8081 -p chrome
437 "pub serve" is compiling test/my_app_test.dart... 441 "pub serve" is compiling test/my_app_test.dart...
438 "pub serve" is compiling test/utils_test.dart... 442 "pub serve" is compiling test/utils_test.dart...
439 00:00 +42: All tests passed! 443 00:00 +42: All tests passed!
440 ``` 444 ```
OLDNEW
« no previous file with comments | « no previous file | image/test1.gif » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698