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

Side by Side Diff: test/runner/engine_test.dart

Issue 2099553002: Add an option to run skipped tests. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 4 years, 5 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 | « test/runner/configuration/top_level_test.dart ('k') | test/runner/expanded_reporter_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:test/src/backend/group.dart'; 7 import 'package:test/src/backend/group.dart';
8 import 'package:test/src/backend/state.dart'; 8 import 'package:test/src/backend/state.dart';
9 import 'package:test/src/runner/configuration.dart';
9 import 'package:test/src/runner/engine.dart'; 10 import 'package:test/src/runner/engine.dart';
10 import 'package:test/src/runner/plugin/environment.dart'; 11 import 'package:test/src/runner/plugin/environment.dart';
11 import 'package:test/src/runner/runner_suite.dart'; 12 import 'package:test/src/runner/runner_suite.dart';
12 import 'package:test/test.dart'; 13 import 'package:test/test.dart';
13 14
14 import '../utils.dart'; 15 import '../utils.dart';
15 16
16 void main() { 17 void main() {
17 test("runs each test in each suite in order", () async { 18 test("runs each test in each suite in order", () async {
18 var testsRun = 0; 19 var testsRun = 0;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 test("doesn't run the test's body", () async { 153 test("doesn't run the test's body", () async {
153 var bodyRun = false; 154 var bodyRun = false;
154 var engine = declareEngine(() { 155 var engine = declareEngine(() {
155 test("test", () => bodyRun = true, skip: true); 156 test("test", () => bodyRun = true, skip: true);
156 }); 157 });
157 158
158 await engine.run(); 159 await engine.run();
159 expect(bodyRun, isFalse); 160 expect(bodyRun, isFalse);
160 }); 161 });
161 162
163 test("runs the test's body with --run-skipped", () async {
164 var bodyRun = false;
165 var engine = declareEngine(() {
166 test("test", () => bodyRun = true, skip: true);
167 }, runSkipped: true);
168
169 await engine.run();
170 expect(bodyRun, isTrue);
171 });
172
162 test("exposes a LiveTest that emits the correct states", () { 173 test("exposes a LiveTest that emits the correct states", () {
163 var tests = declare(() { 174 var tests = declare(() {
164 test("test", () {}, skip: true); 175 test("test", () {}, skip: true);
165 }); 176 });
166 177
167 var engine = new Engine.withSuites([ 178 var engine = new Engine.withSuites([
168 new RunnerSuite(const PluginEnvironment(), new Group.root(tests)) 179 new RunnerSuite(const PluginEnvironment(), new Group.root(tests))
169 ]); 180 ]);
170 181
171 engine.onTestStarted.listen(expectAsync((liveTest) { 182 engine.onTestStarted.listen(expectAsync((liveTest) {
(...skipping 11 matching lines...) Expand all
183 } 194 }
184 i++; 195 i++;
185 }, count: 3)); 196 }, count: 3));
186 197
187 expect(liveTest.onComplete, completes); 198 expect(liveTest.onComplete, completes);
188 })); 199 }));
189 200
190 return engine.run(); 201 return engine.run();
191 }); 202 });
192 }); 203 });
204
205 group("for a skipped group", () {
206 test("doesn't run a test in the group", () async {
207 var bodyRun = false;
208 var engine = declareEngine(() {
209 group("group", () {
210 test("test", () => bodyRun = true);
211 }, skip: true);
212 });
213
214 await engine.run();
215 expect(bodyRun, isFalse);
216 });
217
218 test("runs tests in the group with --run-skipped", () async {
219 var bodyRun = false;
220 var engine = declareEngine(() {
221 group("group", () {
222 test("test", () => bodyRun = true);
223 }, skip: true);
224 }, runSkipped: true);
225
226 await engine.run();
227 expect(bodyRun, isTrue);
228 });
229
230 test("exposes a LiveTest that emits the correct states", () {
231 var entries = declare(() {
232 group("group", () {
233 test("test", () => bodyRun = true);
234 }, skip: true);
235 });
236
237 var engine = new Engine.withSuites([
238 new RunnerSuite(const PluginEnvironment(), new Group.root(entries))
239 ]);
240
241 engine.onTestStarted.listen(expectAsync((liveTest) {
242 expect(liveTest, same(engine.liveTests.single));
243 expect(liveTest.test.name, equals("group test"));
244
245 var i = 0;
246 liveTest.onStateChange.listen(expectAsync((state) {
247 if (i == 0) {
248 expect(state, equals(const State(Status.running, Result.success)));
249 } else if (i == 1) {
250 expect(state, equals(const State(Status.running, Result.skipped)));
251 } else if (i == 2) {
252 expect(state, equals(const State(Status.complete, Result.skipped)));
253 }
254 i++;
255 }, count: 3));
256
257 expect(liveTest.onComplete, completes);
258 }));
259
260 return engine.run();
261 });
262 });
193 } 263 }
OLDNEW
« no previous file with comments | « test/runner/configuration/top_level_test.dart ('k') | test/runner/expanded_reporter_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698