| OLD | NEW |
| 1 // Copyright (c) 2011, 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 part of unittest; | 5 part of unittest; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Describes the interface used by the unit test system for communicating the | 8 * Describes the interface used by the unit test system for communicating the |
| 9 * results of a test run. | 9 * results of a test run. |
| 10 */ | 10 */ |
| 11 abstract class Configuration { | 11 abstract class Configuration { |
| 12 | 12 |
| 13 /** | 13 /** |
| 14 * Creates an instance of [SimpleConfiguration]. | 14 * Creates an instance of [SimpleConfiguration]. |
| 15 */ | 15 */ |
| 16 factory Configuration() => new SimpleConfiguration(); | 16 factory Configuration() => new SimpleConfiguration(); |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * Creates an [Configuration] instances that does nothing. |
| 20 * |
| 21 * For use by subclasses which wish to implement only a subset of features. |
| 22 */ |
| 23 Configuration.blank(); |
| 24 |
| 25 /** |
| 19 * If [true], tests are started automatically. Otherwise [runTests] | 26 * If [true], tests are started automatically. Otherwise [runTests] |
| 20 * must be called explicitly after tests are set up. | 27 * must be called explicitly after tests are set up. |
| 21 */ | 28 */ |
| 22 bool get autoStart; | 29 bool get autoStart => true; |
| 23 | 30 |
| 24 /** | 31 /** |
| 25 * Called as soon as the unittest framework becomes initialized. This is done | 32 * Called as soon as the unittest framework becomes initialized. This is done |
| 26 * even before tests are added to the test framework. It might be used to | 33 * even before tests are added to the test framework. It might be used to |
| 27 * determine/debug errors that occur before the test harness starts executing. | 34 * determine/debug errors that occur before the test harness starts executing. |
| 28 * It is also used to tell the vm or browser that tests are going to be run | 35 * It is also used to tell the vm or browser that tests are going to be run |
| 29 * asynchronously and that the process should wait until they are done. | 36 * asynchronously and that the process should wait until they are done. |
| 30 */ | 37 */ |
| 31 void onInit(); | 38 void onInit() {} |
| 32 | 39 |
| 33 /** Called as soon as the unittest framework starts running. */ | 40 /** Called as soon as the unittest framework starts running. */ |
| 34 void onStart() {} | 41 void onStart() {} |
| 35 | 42 |
| 36 /** | 43 /** |
| 37 * Called when each test starts. Useful to show intermediate progress on | 44 * Called when each test starts. Useful to show intermediate progress on |
| 38 * a test suite. | 45 * a test suite. |
| 39 */ | 46 */ |
| 40 void onTestStart(TestCase testCase); | 47 void onTestStart(TestCase testCase) {} |
| 41 | 48 |
| 42 /** | 49 /** |
| 43 * Called when each test is first completed. Useful to show intermediate | 50 * Called when each test is first completed. Useful to show intermediate |
| 44 * progress on a test suite. | 51 * progress on a test suite. |
| 45 */ | 52 */ |
| 46 void onTestResult(TestCase testCase); | 53 void onTestResult(TestCase testCase) {} |
| 47 | 54 |
| 48 /** | 55 /** |
| 49 * Called when an already completed test changes state. For example: a test | 56 * Called when an already completed test changes state. For example: a test |
| 50 * that was marked as passing may later be marked as being in error because | 57 * that was marked as passing may later be marked as being in error because |
| 51 * it still had callbacks being invoked. | 58 * it still had callbacks being invoked. |
| 52 */ | 59 */ |
| 53 void onTestResultChanged(TestCase testCase); | 60 void onTestResultChanged(TestCase testCase) {} |
| 54 | 61 |
| 55 /** | 62 /** |
| 56 * Handles the logging of messages by a test case. | 63 * Handles the logging of messages by a test case. |
| 57 */ | 64 */ |
| 58 void onLogMessage(TestCase testCase, String message); | 65 void onLogMessage(TestCase testCase, String message) {} |
| 59 | 66 |
| 60 /** | 67 /** |
| 61 * Called when the unittest framework is done running. [success] indicates | 68 * Called when the unittest framework is done running. [success] indicates |
| 62 * whether all tests passed successfully. | 69 * whether all tests passed successfully. |
| 63 */ | 70 */ |
| 64 void onDone(bool success); | 71 void onDone(bool success) {} |
| 65 | 72 |
| 66 /** | 73 /** |
| 67 * Called with the result of all test cases. Browser tests commonly override | 74 * Called with the result of all test cases. Browser tests commonly override |
| 68 * this to reformat the output. | 75 * this to reformat the output. |
| 69 * | 76 * |
| 70 * When [uncaughtError] is not null, it contains an error that occured outside | 77 * When [uncaughtError] is not null, it contains an error that occured outside |
| 71 * of tests (e.g. setting up the test). | 78 * of tests (e.g. setting up the test). |
| 72 */ | 79 */ |
| 73 void onSummary(int passed, int failed, int errors, List<TestCase> results, | 80 void onSummary(int passed, int failed, int errors, List<TestCase> results, |
| 74 String uncaughtError); | 81 String uncaughtError) {} |
| 75 } | 82 } |
| 76 | 83 |
| OLD | NEW |