OLD | NEW |
---|---|
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 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
977 dir.onDone = (ignore) => activityCompleted(); | 977 dir.onDone = (ignore) => activityCompleted(); |
978 dir.list(recursive: listRecursively()); | 978 dir.list(recursive: listRecursively()); |
979 } | 979 } |
980 } | 980 } |
981 // Completed the enqueueing of listers. | 981 // Completed the enqueueing of listers. |
982 activityCompleted(); | 982 activityCompleted(); |
983 } | 983 } |
984 } | 984 } |
985 | 985 |
986 | 986 |
987 /** | |
988 * A standard test suite whose file organization matches an expected structure. | |
nweiz
2012/03/30 00:38:37
Woo!
Bob Nystrom
2012/03/30 01:06:17
I need to rebase, this is actually in another patc
| |
989 * To use this, your suite should look like: | |
990 * | |
991 * dart/ | |
992 * path/ | |
993 * to/ | |
994 * mytestsuite/ | |
995 * mytestsuite.status | |
996 * example1_tests.dart | |
997 * example2_tests.dart | |
998 * example3_tests.dart | |
999 * | |
1000 * The important parts: | |
1001 * | |
1002 * * The leaf directory name is the name of your test suite. | |
1003 * * The status file uses the same name. | |
1004 * * Test files are directly in that directory and end in "_tests.dart". | |
1005 * | |
1006 * If you follow that convention, then you can construct one of these like: | |
1007 * | |
1008 * new DirectoryTestSuite(configuration, 'path/to/mytestsuite'); | |
1009 * | |
1010 * instead of having to create a custom [StandardTestSuite] subclass. In | |
1011 * particular, if you add 'path/to/mytestsuite' to [TEST_SUITE_DIRECTORIES] in | |
1012 * test.dart, this will all be set up for you. | |
1013 */ | |
1014 class DirectoryTestSuite extends StandardTestSuite { | |
1015 factory DirectoryTestSuite(Map configuration, String directory) { | |
1016 final name = directory.substring(directory.lastIndexOf('/') + 1); | |
1017 print(name); | |
1018 | |
1019 return new DirectoryTestSuite._internal(configuration, | |
1020 name, directory, ['$directory/$name.status']); | |
1021 } | |
1022 | |
1023 DirectoryTestSuite._internal(Map configuration, | |
1024 String suiteName, | |
1025 String directoryPath, | |
1026 List<String> statusFilePaths) | |
1027 : super(configuration, suiteName, directoryPath, statusFilePaths); | |
1028 | |
1029 bool isTestFile(String filename) => filename.endsWith('_tests.dart'); | |
1030 } | |
1031 | |
1032 | |
987 class JUnitTestSuite implements TestSuite { | 1033 class JUnitTestSuite implements TestSuite { |
988 Map configuration; | 1034 Map configuration; |
989 String suiteName; | 1035 String suiteName; |
990 String directoryPath; | 1036 String directoryPath; |
991 String statusFilePath; | 1037 String statusFilePath; |
992 final String dartDir; | 1038 final String dartDir; |
993 String buildDir; | 1039 String buildDir; |
994 String classPath; | 1040 String classPath; |
995 List<String> testClasses; | 1041 List<String> testClasses; |
996 Function doTest; | 1042 Function doTest; |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1290 * $noCrash tests are expected to be flaky but not crash | 1336 * $noCrash tests are expected to be flaky but not crash |
1291 * $pass tests are expected to pass | 1337 * $pass tests are expected to pass |
1292 * $failOk tests are expected to fail that we won't fix | 1338 * $failOk tests are expected to fail that we won't fix |
1293 * $fail tests are expected to fail that we should fix | 1339 * $fail tests are expected to fail that we should fix |
1294 * $crash tests are expected to crash that we should fix | 1340 * $crash tests are expected to crash that we should fix |
1295 * $timeout tests are allowed to timeout | 1341 * $timeout tests are allowed to timeout |
1296 """; | 1342 """; |
1297 print(report); | 1343 print(report); |
1298 } | 1344 } |
1299 } | 1345 } |
OLD | NEW |