| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 library unittest.configuration; | |
| 6 | |
| 7 import 'package:unittest/unittest.dart' show TestCase, SimpleConfiguration; | |
| 8 | |
| 9 /// Describes the interface used by the unit test system for communicating the | |
| 10 /// results of a test run. | |
| 11 abstract class Configuration { | |
| 12 | |
| 13 /// Creates an instance of [SimpleConfiguration]. | |
| 14 factory Configuration() => new SimpleConfiguration(); | |
| 15 | |
| 16 /// Creates an [Configuration] instances that does nothing. | |
| 17 /// | |
| 18 /// For use by subclasses which wish to implement only a subset of features. | |
| 19 Configuration.blank(); | |
| 20 | |
| 21 /// If [:true:], tests are started automatically. Otherwise [runTests] | |
| 22 /// must be called explicitly after tests are set up. | |
| 23 bool get autoStart => true; | |
| 24 | |
| 25 /// How long a [TestCase] can run before it is considered an error. | |
| 26 /// A [timeout] value of [:null:] means that the limit is infinite. | |
| 27 Duration timeout = const Duration(minutes: 2); | |
| 28 | |
| 29 /// Called as soon as the unittest framework becomes initialized. | |
| 30 /// | |
| 31 /// This is done even before tests are added to the test framework. It might | |
| 32 /// be used to determine/debug errors that occur before the test harness | |
| 33 /// starts executing. It is also used to tell the vm or browser that tests are | |
| 34 /// going to be run asynchronously and that the process should wait until they | |
| 35 /// are done. | |
| 36 void onInit() {} | |
| 37 | |
| 38 /// Called as soon as the unittest framework starts running. | |
| 39 void onStart() {} | |
| 40 | |
| 41 /// Called when each test starts. Useful to show intermediate progress on | |
| 42 /// a test suite. | |
| 43 void onTestStart(TestCase testCase) {} | |
| 44 | |
| 45 /// Called when each test is first completed. Useful to show intermediate | |
| 46 /// progress on a test suite. | |
| 47 void onTestResult(TestCase testCase) {} | |
| 48 | |
| 49 /// 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 | |
| 51 /// it still had callbacks being invoked. | |
| 52 void onTestResultChanged(TestCase testCase) {} | |
| 53 | |
| 54 /// Handles the logging of messages by a test case. | |
| 55 void onLogMessage(TestCase testCase, String message) {} | |
| 56 | |
| 57 /// Called when the unittest framework is done running. [success] indicates | |
| 58 /// whether all tests passed successfully. | |
| 59 void onDone(bool success) {} | |
| 60 | |
| 61 /// Called with the result of all test cases. Browser tests commonly override | |
| 62 /// this to reformat the output. | |
| 63 /// | |
| 64 /// When [uncaughtError] is not null, it contains an error that occured outsid
e | |
| 65 /// of tests (e.g. setting up the test). | |
| 66 void onSummary(int passed, int failed, int errors, List<TestCase> results, | |
| 67 String uncaughtError) {} | |
| 68 } | |
| 69 | |
| OLD | NEW |