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 'simple_configuration.dart'; | |
8 import 'test_case.dart'; | |
9 | |
10 /// Describes the interface used by the unit test system for communicating the | |
11 /// results of a test run. | |
12 abstract class Configuration { | |
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 once they're finished being def
ined. | |
22 /// | |
23 /// Otherwise, [runTests] must be called explicitly after tests are set up. | |
24 final autoStart = true; | |
25 | |
26 /// How long a [TestCase] can run before it is considered an error. | |
27 /// A [timeout] value of [:null:] means that the limit is infinite. | |
28 Duration timeout = const Duration(minutes: 2); | |
29 | |
30 /// Called as soon as the unittest framework becomes initialized. | |
31 /// | |
32 /// This is done even before tests are added to the test framework. It might | |
33 /// be used to determine/debug errors that occur before the test harness | |
34 /// starts executing. It is also used to tell the vm or browser that tests are | |
35 /// going to be run asynchronously and that the process should wait until they | |
36 /// are done. | |
37 void onInit() {} | |
38 | |
39 /// Called as soon as the unittest framework starts running. | |
40 void onStart() {} | |
41 | |
42 /// Called when each test starts. Useful to show intermediate progress on | |
43 /// a test suite. | |
44 void onTestStart(TestCase testCase) {} | |
45 | |
46 /// Called when each test is first completed. Useful to show intermediate | |
47 /// progress on a test suite. | |
48 void onTestResult(TestCase testCase) {} | |
49 | |
50 /// Called when an already completed test changes state. For example: a test | |
51 /// that was marked as passing may later be marked as being in error because | |
52 /// it still had callbacks being invoked. | |
53 void onTestResultChanged(TestCase testCase) {} | |
54 | |
55 /// Handles the logging of messages by a test case. | |
56 void onLogMessage(TestCase testCase, String message) {} | |
57 | |
58 /// Called when the unittest framework is done running. [success] indicates | |
59 /// whether all tests passed successfully. | |
60 void onDone(bool success) {} | |
61 | |
62 /// Called with the result of all test cases. Browser tests commonly override | |
63 /// this to reformat the output. | |
64 /// | |
65 /// When [uncaughtError] is not null, it contains an error that occured outsid
e | |
66 /// of tests (e.g. setting up the test). | |
67 void onSummary(int passed, int failed, int errors, List<TestCase> results, | |
68 String uncaughtError) {} | |
69 } | |
OLD | NEW |