Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(750)

Side by Side Diff: lib/src/runner/live_suite.dart

Issue 1887853002: Add a LiveSuite class. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/runner/engine.dart ('k') | lib/src/runner/live_suite_controller.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2016, 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 import 'dart:async';
6
7 import 'package:collection/collection.dart';
8
9 import '../backend/live_test.dart';
10 import 'runner_suite.dart';
11
12 /// A view of the execution of a test suite.
13 ///
14 /// This is distinct from [Suite] because it represents the progress of running
15 /// a suite rather than the suite's contents. It provides events and collections
16 /// that give the caller a view into the suite's current state.
17 abstract class LiveSuite {
18 /// The suite that's being run.
19 RunnerSuite get suite;
20
21 /// Whether the suite has completed.
22 ///
23 /// Note that even if this returns `true`, the suite may still be running code
24 /// asynchronously. A suite is considered complete once all of its tests are
25 /// complete, but it's possible for a test to continue running even after it's
26 /// been marked complete—see [LiveTest.isComplete] for details.
27 ///
28 /// The [isClosed] getter can be used to determine whether the suite and its
29 /// tests are guaranteed to emit no more events.
30 bool get isComplete;
31
32 /// A [Future] that completes once the suite is complete.
33 ///
34 /// Note that even once this completes, the suite may still be running code
35 /// asynchronously. A suite is considered complete once all of its tests are
36 /// complete, but it's possible for a test to continue running even after it's
37 /// been marked complete—see [LiveTest.isComplete] for details.
38 ///
39 /// The [onComplete] future can be used to determine when the suite and its
40 /// tests are guaranteed to emit no more events.
41 Future get onComplete;
42
43 /// Whether the suite has been closed.
44 ///
45 /// If this is `true`, no code is running for the suite or any of its tests.
46 /// At this point, the caller can be sure that the suites' tests are all in
47 /// fixed states that will not change in the future.
48 bool get isClosed;
49
50 /// A [Future] that completes when the suite has been closed.
51 ///
52 /// Once this completes, no code is running for the suite or any of its tests.
53 /// At this point, the caller can be sure that the suites' tests are all in
54 /// fixed states that will not change in the future.
55 Future get onClose;
56
57 /// All the currently-known tests in this suite that have run or are running.
58 ///
59 /// This is guaranteed to contain the same tests as the union of [passed],
60 /// [skipped], [failed], and [active].
61 Set<LiveTest> get liveTests {
62 var sets = [passed, skipped, failed];
63 if (active != null) sets.add(new Set.from([active]));
64 return new GroupSet.from(sets);
65 }
66
67 /// A stream that emits each [LiveTest] in this suite as it's about to start
68 /// running.
69 ///
70 /// This is guaranteed to fire before [LiveTest.onStateChange] first fires. It
71 /// will close once all tests the user has selected are run.
72 Stream<LiveTest> get onTestStarted;
73
74 /// The set of tests in this suite that have completed and been marked as
75 /// passing.
76 Set<LiveTest> get passed;
77
78 /// The set of tests in this suite that have completed and been marked as
79 /// skipped.
80 Set<LiveTest> get skipped;
81
82 /// The set of tests in this suite that have completed and been marked as
83 /// failing or error.
84 Set<LiveTest> get failed;
85
86 /// The currently running test in this suite, or `null` if no test is running.
87 LiveTest get active;
88 }
OLDNEW
« no previous file with comments | « lib/src/runner/engine.dart ('k') | lib/src/runner/live_suite_controller.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698