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

Unified Diff: tools/testing/dart/test_suite.dart

Issue 9863057: Add DirectoryTestSuite. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Oops. Add changes. Created 8 years, 9 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
Index: tools/testing/dart/test_suite.dart
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
index da9cf11dc32fed1174b597f7f898487c59593f6a..e9d77a343233399b55d6c7861607b383db119c6e 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -186,6 +186,7 @@ class TestInformation {
this.hasRuntimeErrors, this.multitestOutcome);
}
+
/**
* A standard [TestSuite] implementation that searches for tests in a
* directory, and creates [TestCase]s that compile and/or run them.
@@ -925,6 +926,52 @@ class DartcCompilationTestSuite extends StandardTestSuite {
}
+/**
+ * A standard test suite whose file organization matches an expected structure.
+ * To use this, your suite should look like:
+ *
+ * dart/
+ * path/
+ * to/
+ * mytestsuite/
+ * mytestsuite.status
+ * example1_tests.dart
+ * example2_tests.dart
+ * example3_tests.dart
+ *
+ * The important parts:
+ *
+ * * The leaf directory name is the name of your test suite.
+ * * The status file uses the same name.
+ * * Test files are directly in that directory and end in "_tests.dart".
+ *
+ * If you follow that convention, then you can construct one of these like:
+ *
+ * new DirectoryTestSuite(configuration, 'path/to/mytestsuite');
+ *
+ * instead of having to create a custom [StandardTestSuite] subclass. In
+ * particular, if you add 'path/to/mytestsuite' to [TEST_SUITE_DIRECTORIES] in
+ * test.dart, this will all be set up for you.
+ */
+class DirectoryTestSuite extends StandardTestSuite {
Bill Hesse 2012/03/28 23:37:30 I really think we can merge the classes: Make isTe
Bob Nystrom 2012/03/29 00:10:17 Excellent idea. Done!
+ factory DirectoryTestSuite(Map configuration, String directory) {
+ final name = directory.substring(directory.lastIndexOf('/') + 1);
+ print(name);
Bill Hesse 2012/03/28 23:37:30 Remove the print statement.
Bob Nystrom 2012/03/29 00:10:17 Done.
+
+ return new DirectoryTestSuite._internal(configuration,
+ name, directory, ['$directory/$name.status']);
+ }
+
+ DirectoryTestSuite._internal(Map configuration,
+ String suiteName,
+ String directoryPath,
+ List<String> statusFilePaths)
+ : super(configuration, suiteName, directoryPath, statusFilePaths);
+
+ bool isTestFile(String filename) => filename.endsWith('_tests.dart');
+}
+
+
class JUnitTestSuite implements TestSuite {
Map configuration;
String suiteName;

Powered by Google App Engine
This is Rietveld 408576698