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

Side by Side 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, 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Classes and methods for enumerating and preparing tests. 6 * Classes and methods for enumerating and preparing tests.
7 * 7 *
8 * This library includes: 8 * This library includes:
9 * 9 *
10 * - Creating tests by listing all the Dart files in certain directories, 10 * - Creating tests by listing all the Dart files in certain directories,
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 bool isNegativeIfChecked; 179 bool isNegativeIfChecked;
180 bool hasFatalTypeErrors; 180 bool hasFatalTypeErrors;
181 bool hasRuntimeErrors; 181 bool hasRuntimeErrors;
182 Set<String> multitestOutcome; 182 Set<String> multitestOutcome;
183 183
184 TestInformation(this.filename, this.optionsFromFile, this.isNegative, 184 TestInformation(this.filename, this.optionsFromFile, this.isNegative,
185 this.isNegativeIfChecked, this.hasFatalTypeErrors, 185 this.isNegativeIfChecked, this.hasFatalTypeErrors,
186 this.hasRuntimeErrors, this.multitestOutcome); 186 this.hasRuntimeErrors, this.multitestOutcome);
187 } 187 }
188 188
189
189 /** 190 /**
190 * A standard [TestSuite] implementation that searches for tests in a 191 * A standard [TestSuite] implementation that searches for tests in a
191 * directory, and creates [TestCase]s that compile and/or run them. 192 * directory, and creates [TestCase]s that compile and/or run them.
192 */ 193 */
193 class StandardTestSuite implements TestSuite { 194 class StandardTestSuite implements TestSuite {
194 Map configuration; 195 Map configuration;
195 String suiteName; 196 String suiteName;
196 String directoryPath; 197 String directoryPath;
197 List<String> statusFilePaths; 198 List<String> statusFilePaths;
198 Function doTest; 199 Function doTest;
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 dir.onDone = (ignore) => activityCompleted(); 919 dir.onDone = (ignore) => activityCompleted();
919 dir.list(recursive: listRecursively()); 920 dir.list(recursive: listRecursively());
920 } 921 }
921 } 922 }
922 // Completed the enqueueing of listers. 923 // Completed the enqueueing of listers.
923 activityCompleted(); 924 activityCompleted();
924 } 925 }
925 } 926 }
926 927
927 928
929 /**
930 * A standard test suite whose file organization matches an expected structure.
931 * To use this, your suite should look like:
932 *
933 * dart/
934 * path/
935 * to/
936 * mytestsuite/
937 * mytestsuite.status
938 * example1_tests.dart
939 * example2_tests.dart
940 * example3_tests.dart
941 *
942 * The important parts:
943 *
944 * * The leaf directory name is the name of your test suite.
945 * * The status file uses the same name.
946 * * Test files are directly in that directory and end in "_tests.dart".
947 *
948 * If you follow that convention, then you can construct one of these like:
949 *
950 * new DirectoryTestSuite(configuration, 'path/to/mytestsuite');
951 *
952 * instead of having to create a custom [StandardTestSuite] subclass. In
953 * particular, if you add 'path/to/mytestsuite' to [TEST_SUITE_DIRECTORIES] in
954 * test.dart, this will all be set up for you.
955 */
956 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!
957 factory DirectoryTestSuite(Map configuration, String directory) {
958 final name = directory.substring(directory.lastIndexOf('/') + 1);
959 print(name);
Bill Hesse 2012/03/28 23:37:30 Remove the print statement.
Bob Nystrom 2012/03/29 00:10:17 Done.
960
961 return new DirectoryTestSuite._internal(configuration,
962 name, directory, ['$directory/$name.status']);
963 }
964
965 DirectoryTestSuite._internal(Map configuration,
966 String suiteName,
967 String directoryPath,
968 List<String> statusFilePaths)
969 : super(configuration, suiteName, directoryPath, statusFilePaths);
970
971 bool isTestFile(String filename) => filename.endsWith('_tests.dart');
972 }
973
974
928 class JUnitTestSuite implements TestSuite { 975 class JUnitTestSuite implements TestSuite {
929 Map configuration; 976 Map configuration;
930 String suiteName; 977 String suiteName;
931 String directoryPath; 978 String directoryPath;
932 String statusFilePath; 979 String statusFilePath;
933 final String dartDir; 980 final String dartDir;
934 String buildDir; 981 String buildDir;
935 String classPath; 982 String classPath;
936 List<String> testClasses; 983 List<String> testClasses;
937 Function doTest; 984 Function doTest;
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 * $noCrash tests are expected to be flaky but not crash 1278 * $noCrash tests are expected to be flaky but not crash
1232 * $pass tests are expected to pass 1279 * $pass tests are expected to pass
1233 * $failOk tests are expected to fail that we won't fix 1280 * $failOk tests are expected to fail that we won't fix
1234 * $fail tests are expected to fail that we should fix 1281 * $fail tests are expected to fail that we should fix
1235 * $crash tests are expected to crash that we should fix 1282 * $crash tests are expected to crash that we should fix
1236 * $timeout tests are allowed to timeout 1283 * $timeout tests are allowed to timeout
1237 """; 1284 """;
1238 print(report); 1285 print(report);
1239 } 1286 }
1240 } 1287 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698