OLD | NEW |
1 JSON Reporter Protocol | 1 JSON Reporter Protocol |
2 ====================== | 2 ====================== |
3 | 3 |
4 The test runner supports a JSON reporter which provides a machine-readable | 4 The test runner supports a JSON reporter which provides a machine-readable |
5 representation of the test runner's progress. This reporter is intended for use | 5 representation of the test runner's progress. This reporter is intended for use |
6 by IDEs and other tools to present a custom view of the test runner's operation | 6 by IDEs and other tools to present a custom view of the test runner's operation |
7 without needing to parse output intended for humans. | 7 without needing to parse output intended for humans. |
8 | 8 |
9 Note that the test runner is highly asynchronous, and users of this protocol | 9 Note that the test runner is highly asynchronous, and users of this protocol |
10 shouldn't make assumptions about the ordering of events beyond what's explicitly | 10 shouldn't make assumptions about the ordering of events beyond what's explicitly |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 283 |
284 // The ID of the suite containing this test. | 284 // The ID of the suite containing this test. |
285 int suiteID; | 285 int suiteID; |
286 | 286 |
287 // The IDs of groups containing this test, in order from outermost to | 287 // The IDs of groups containing this test, in order from outermost to |
288 // innermost. | 288 // innermost. |
289 List<int> groupIDs; | 289 List<int> groupIDs; |
290 | 290 |
291 // The test's metadata, including metadata from any containing groups. | 291 // The test's metadata, including metadata from any containing groups. |
292 Metadata metadata; | 292 Metadata metadata; |
| 293 |
| 294 // The (1-based) line on which the test was defined, or `null`. |
| 295 int line; |
| 296 |
| 297 // The (1-based) column on which the test was defined, or `null`. |
| 298 int column; |
| 299 |
| 300 // The URL for the file in which the test was defined, or `null`. |
| 301 String url; |
293 } | 302 } |
294 ``` | 303 ``` |
295 | 304 |
296 A single test case. The test's ID is unique in the context of this test run. | 305 A single test case. The test's ID is unique in the context of this test run. |
297 It's used elsewhere in the protocol to refer to this test without including its | 306 It's used elsewhere in the protocol to refer to this test without including its |
298 full representation. | 307 full representation. |
299 | 308 |
300 Most tests will have at least one group ID, representing the implicit root | 309 Most tests will have at least one group ID, representing the implicit root |
301 group. However, some may not; these should be treated as having no group | 310 group. However, some may not; these should be treated as having no group |
302 metadata. | 311 metadata. |
303 | 312 |
| 313 The `line`, `column`, and `url` fields indicate the location the `test()` |
| 314 function was called to create this test. They're treated as a unit: they'll |
| 315 either all be `null` or they'll all be non-`null`. The URL is always absolute, |
| 316 and may be a `package:` URL. |
| 317 |
304 ### Suite | 318 ### Suite |
305 | 319 |
306 ``` | 320 ``` |
307 class Suite { | 321 class Suite { |
308 // An opaque ID for the group. | 322 // An opaque ID for the group. |
309 int id; | 323 int id; |
310 | 324 |
311 // The platform on which the suite is running. | 325 // The platform on which the suite is running. |
312 String? platform; | 326 String? platform; |
313 | 327 |
(...skipping 28 matching lines...) Expand all Loading... |
342 int suiteID; | 356 int suiteID; |
343 | 357 |
344 // The ID of the group's parent group, unless it's the root group. | 358 // The ID of the group's parent group, unless it's the root group. |
345 int? parentID; | 359 int? parentID; |
346 | 360 |
347 // The group's metadata, including metadata from any containing groups. | 361 // The group's metadata, including metadata from any containing groups. |
348 Metadata metadata; | 362 Metadata metadata; |
349 | 363 |
350 // The number of tests (recursively) within this group. | 364 // The number of tests (recursively) within this group. |
351 int testCount; | 365 int testCount; |
| 366 |
| 367 // The (1-based) line on which the group was defined, or `null`. |
| 368 int line; |
| 369 |
| 370 // The (1-based) column on which the group was defined, or `null`. |
| 371 int column; |
| 372 |
| 373 // The URL for the file in which the group was defined, or `null`. |
| 374 String url; |
352 } | 375 } |
353 ``` | 376 ``` |
354 | 377 |
355 A group containing test cases. The group's ID is unique in the context of this | 378 A group containing test cases. The group's ID is unique in the context of this |
356 test run. It's used elsewhere in the protocol to refer to this group without | 379 test run. It's used elsewhere in the protocol to refer to this group without |
357 including its full representation. | 380 including its full representation. |
358 | 381 |
359 The implicit group at the root of each test suite has `null` `name` and | 382 The implicit group at the root of each test suite has `null` `name` and |
360 `parentID` attributes. | 383 `parentID` attributes. |
361 | 384 |
| 385 The `line`, `column`, and `url` fields indicate the location the `group()` |
| 386 function was called to create this group. They're treated as a unit: they'll |
| 387 either all be `null` or they'll all be non-`null`. The URL is always absolute, |
| 388 and may be a `package:` URL. |
| 389 |
362 ### Metadata | 390 ### Metadata |
363 | 391 |
364 ``` | 392 ``` |
365 class Metadata { | 393 class Metadata { |
366 // Whether the test case will be skipped by the test runner. | 394 // Whether the test case will be skipped by the test runner. |
367 bool skip; | 395 bool skip; |
368 | 396 |
369 // The reason the test case is skipped, if the user provided it. | 397 // The reason the test case is skipped, if the user provided it. |
370 String? skipReason; | 398 String? skipReason; |
371 } | 399 } |
372 ``` | 400 ``` |
373 | 401 |
374 The metadata attached to a test by a user. | 402 The metadata attached to a test by a user. |
OLD | NEW |