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

Unified Diff: README.md

Issue 1092153003: Support an @OnPlatform annotation. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes 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/src/backend/suite.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 86fca1a4de2cb690b70c2d176212f58f19943c02..d1602fd9ecaaaff22ac79e44ce950af28c9f868a 100644
--- a/README.md
+++ b/README.md
@@ -403,6 +403,41 @@ 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.
+### Platform-Specific Configuration
+
+Sometimes a test may need to be configured differently for different platforms.
+Windows might run your code slower than other platforms, or your DOM
+manipulation might not work right on Safari yet. For these cases, you can use
+the `@OnPlatform` annotation and the `onPlatform` named parameter to `test()`
+and `group()`. For example:
+
+```dart
+@OnPlatform(const {
+ // Give Windows some extra wiggle-room before timing out.
+ "windows": const Timeout.factor(2)
+})
+
+import "package:test/test.dart";
+
+void main() {
+ test("do a thing", () {
+ // ...
+ }, onPlatform: {
+ "safari": new Skip("Safari is currently broken (see #1234)")
+ });
+}
+```
+
+Both the annotation and the parameter take a map. The map's keys are [platform
+selectors](#platform-selector-syntax) which describe the platforms for which the
+specialized configuration applies. Its values are instances of some of the same
+annotation classes that can be used for a suite: `Skip` and `Timeout`. A value
+can also be a list of these values.
+
+If multiple platforms match, the configuration is applied in order from first to
+last, just as they would in nested groups. This means that for configuration
+like duration-based timeouts, the last matching value wins.
+
## 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/src/backend/suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698