OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 * A unit test library for running groups of tests in a browser, instead of the | 6 * A unit test library for running groups of tests in a browser, instead of the |
7 * entire test file. This is especially used for large tests files that have | 7 * entire test file. This is especially used for large tests files that have |
8 * many subtests, so we can mark groups as failing at a finer granularity than | 8 * many subtests, so we can mark groups as failing at a finer granularity than |
9 * the entire test file. | 9 * the entire test file. |
10 * | 10 * |
(...skipping 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 | 35 |
36 var testGroupName = groups.single.split('=')[1]; | 36 var testGroupName = groups.single.split('=')[1]; |
37 var startsWith = "$testGroupName${unittest.groupSep}"; | 37 var startsWith = "$testGroupName${unittest.groupSep}"; |
38 unittest.filterTests((unittest.TestCase tc) => | 38 unittest.filterTests((unittest.TestCase tc) => |
39 tc.description.startsWith(startsWith)); | 39 tc.description.startsWith(startsWith)); |
40 } | 40 } |
41 } | 41 } |
42 super.onStart(); | 42 super.onStart(); |
43 } | 43 } |
| 44 |
| 45 bool _failedOrErrors = false; |
| 46 void onSummary(int passed, int failed, int errors, List<TestCase> results, |
| 47 String uncaughtError) { |
| 48 super.onSummary(passed, failed, errors, results, uncaughtError); |
| 49 |
| 50 _failedOrErrors = failed > 0 || errors > 0; |
| 51 } |
| 52 |
| 53 void onDone(bool success) { |
| 54 if (!success) { |
| 55 success = !_failedOrErrors; |
| 56 } |
| 57 super.onDone(success); |
| 58 } |
44 } | 59 } |
45 | 60 |
46 void useHtmlIndividualConfiguration([bool isLayoutTest = false]) { | 61 void useHtmlIndividualConfiguration([bool isLayoutTest = false]) { |
47 unittest.unittestConfiguration = isLayoutTest ? _singletonLayout : _singletonN
otLayout; | 62 unittest.unittestConfiguration = isLayoutTest ? _singletonLayout : _singletonN
otLayout; |
48 } | 63 } |
49 | 64 |
50 final _singletonLayout = new HtmlIndividualConfiguration(true); | 65 final _singletonLayout = new HtmlIndividualConfiguration(true); |
51 final _singletonNotLayout = new HtmlIndividualConfiguration(false); | 66 final _singletonNotLayout = new HtmlIndividualConfiguration(false); |
OLD | NEW |