Test constructor

Test({
  1. required int id,
  2. required String name,
  3. required int suiteID,
  4. required List<int> groupIDs,
  5. int? line,
  6. int? column,
  7. String? url,
  8. @JsonKey(name: 'root_line') int? rootLine,
  9. @JsonKey(name: 'root_column') int? rootColumn,
  10. @JsonKey(name: 'root_url') String? rootUrl,
  11. required Metadata metadata,
})

A single test case. The test's ID is unique in the context of this test run. It's used elsewhere in the protocol to refer to this test without including its full representation.

Most tests will have at least one group ID, representing the implicit root group. However, some may not; these should be treated as having no group metadata.

The line, column, and url fields indicate the location the test() function was called to create this test. They're treated as a unit: they'll either all be null or they'll all be non-null. The URL is always absolute, and may be a package: URL.

Implementation

factory Test({
  /// An opaque ID for the test.
  required int id,

  /// The name of the test, including prefixes from any containing groups.
  required String name,

  /// The ID of the suite containing this test.
  required int suiteID,

  /// The IDs of groups containing this test, in order from outermost to
  /// innermost.
  required List<int> groupIDs,

  /// The (1-based) line on which the test was defined, or `null`.
  int? line,

  /// The (1-based) column on which the test was defined, or `null`.
  int? column,

  /// The URL for the file in which the test was defined, or `null`.
  String? url,

  /// The (1-based) line in the original test suite from which the test
  /// originated.
  ///
  /// Will only be present if `root_url` is different from `url`.
  @JsonKey(name: 'root_line') int? rootLine,

  /// The (1-based) line on in the original test suite from which the test
  /// originated.
  ///
  /// Will only be present if `root_url` is different from `url`.
  @JsonKey(name: 'root_column') int? rootColumn,

  /// The URL for the original test suite in which the test was defined.
  ///
  /// Will only be present if different from `url`.
  @JsonKey(name: 'root_url') String? rootUrl,

  /// Metadatas about a test
  required Metadata metadata,
}) = _Test;