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

Unified Diff: README.md

Issue 1086213002: Support a @Timeout annotation. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: CHANGELOG + README 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « CHANGELOG.md ('k') | lib/pub_serve.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: README.md
diff --git a/README.md b/README.md
index 9e951906fc2a12217247a0f42fa6496172ead231..70404d3b620fea67a165e0cc4648129b892ba662 100644
--- a/README.md
+++ b/README.md
@@ -278,6 +278,49 @@ void main() {
[expectAsync]: http://www.dartdocs.org/documentation/test/latest/index.html#test/test@id_expectAsync
+## Configuring Tests
+
+### Timeouts
+
+By default, tests will time out after 30 seconds of inactivity. However, this
+can be configured on a per-test, -group, or -suite basis. To change the timeout
+for a test suite, put a `@Timeout` annotation at the top of the file:
+
+```dart
+@Timeout(new Duration(seconds: 45))
+
+import "package:test/test.dart";
+
+void main() {
+ // ...
+}
+```
+
+In addition to setting an absolute timeout, you can set the timeout relative to
+the default using `@Timeout.factor`. For example, `@Timeout.factor(1.5)` will
+set the timeout to one and a half times as long as the default—45 seconds.
+
+Timeouts can be set for tests and groups using the `timeout` parameter. This
+parameter takes a `Timeout` object just like the annotation. For example:
+
+```dart
+import "package:test/test.dart";
+
+void main() {
+ group("slow tests", () {
+ // ...
+
+ test("even slower test", () {
+ // ...
+ }, timeout: new Timeout.factor(2))
+ }, timeout: new Timeout(new Duration(minutes: 1)));
+}
+```
+
+Nested timeouts apply in order from outermost to innermost. That means that
+"even slower test" will take two minutes to time out, since it multiplies the
+group's timeout by 2.
+
## Testing With `barback`
Packages using the `barback` transformer system may need to test code that's
« no previous file with comments | « CHANGELOG.md ('k') | lib/pub_serve.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698