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

Unified Diff: lib/test.dart

Issue 1400743002: Add support for setUpAll and tearDownAll. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 2 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 | « lib/src/runner/vm/isolate_listener.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/test.dart
diff --git a/lib/test.dart b/lib/test.dart
index e662d1e5289a41027a4135a21530a5df2f027ec4..48235ff78e4ced7fd86eda507e2080fd6ef6ebd2 100644
--- a/lib/test.dart
+++ b/lib/test.dart
@@ -187,6 +187,34 @@ void setUp(callback()) => _declarer.setUp(callback);
/// reverse of the order they were declared.
void tearDown(callback()) => _declarer.tearDown(callback);
+/// Registers a function to be run once before all tests.
+///
+/// [callback] may be asynchronous; if so, it must return a [Future].
+///
+/// If this is called within a test group, [callback] will run before all tests
+/// in that group. It will be run after any [setUpAll] callbacks in parent
+/// groups or at the top level. It won't be run if none of the tests in the
+/// group are run.
+///
+/// **Note**: This function makes it very easy to accidentally introduce hidden
+/// dependencies between tests that should be isolated. In general, you should
+/// prefer [setUp], and only use [setUpAll] if the callback is prohibitively
+/// slow.
+void setUpAll(callback()) => _declarer.setUpAll(callback);
+
+/// Registers a function to be run once after all tests.
+///
+/// If this is called within a test group, [callback] will run after all tests
+/// in that group. It will be run before any [tearDownAll] callbacks in parent
+/// groups or at the top level. It won't be run if none of the tests in the
+/// group are run.
+///
+/// **Note**: This function makes it very easy to accidentally introduce hidden
+/// dependencies between tests that should be isolated. In general, you should
+/// prefer [tearDown], and only use [tearDOwnAll] if the callback is
+/// prohibitively slow.
+void tearDownAll(callback()) => _declarer.tearDownAll(callback);
+
/// Registers an exception that was caught for the current test.
void registerException(error, [StackTrace stackTrace]) {
// This will usually forward directly to [Invoker.current.handleError], but
« no previous file with comments | « lib/src/runner/vm/isolate_listener.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698