TestEvent class sealed

This is the root class of the protocol. All root-level objects emitted by the JSON reporter will be subclasses of TestEvent. https://github.com/dart-lang/test/blob/master/pkgs/test/doc/json_reporter.md

Available extensions
Annotations
  • @Freezed.new(unionKey: 'type')

Constructors

TestEvent.allSuites({required int count, required int time})
A single suite count event is emitted once the test runner knows the total number of suites that will be loaded over the course of the test run. Because this is determined asynchronously, its position relative to other events (except TestStartTestEvent) is not guaranteed.
const
factory
TestEvent.debug({required int suiteID, required String? observatory, required String? remoteDebugger, required int time})
A debug event is emitted after (although not necessarily directly after) a TestSuiteEvent, and includes information about how to debug that suite. It's only emitted if the --debug flag is passed to the test runner.
const
factory
TestEvent.done({required bool? success, required int time})
An event indicating the result of the entire test run. This will be the final event emitted by the reporter.
const
factory
TestEvent.error({required int testID, required String error, required String stackTrace, required bool isFailure, required int time})
An ErrorTestEvent indicates that a test encountered an uncaught error. Note that this may happen even after the test has completed, in which case it should be considered to have failed.
const
factory
TestEvent.exit({required int exitCode, required int time})
An event emitted when a test completes. The exitCode attribute indicates the result of the test process.
const
factory
TestEvent.fromJson(Map<String, dynamic> json)
factory
TestEvent.group({required TestGroup group, required int time})
A group event is emitted before any TestStartEvent for tests in a given group. This is the only event that contains the full metadata about a group; future events will refer to the group by its opaque ID.
const
factory
TestEvent.message({required int testID, required String messageType, required String message, required int time})
A MessageEvent indicates that a test emitted a message that should be displayed to the user. The messageType field indicates the precise type of this message. Different message types should be visually distinguishable.
const
factory
TestEvent.start({required String protocolVersion, required String? runnerVersion, required int pid, required int time})
A single start event is emitted before any other events. It indicates that the test runner has started running.
const
factory
TestEvent.startTest({required Test test, required int time})
An event emitted when a test begins running. This is the only event that contains the full metadata about a test; future events will refer to the test by its opaque ID.
const
factory
TestEvent.suite({required TestSuite suite, required int time})
A suite event is emitted before any GroupEvents for groups in a given test suite. This is the only event that contains the full metadata about a suite; future events will refer to the suite by its opaque ID.
const
factory
TestEvent.testDone({required int testID, required TestResult result, required bool hidden, required bool skipped, required int time})
An event emitted when a test completes. The result attribute indicates the result of the test.
const
factory

Properties

copyWith → $TestEventCopyWith<TestEvent>
Create a copy of TestEvent with the given fields replaced by the non-null parameter values.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
time int
The time (in milliseconds) that has elapsed since the test runner started.
no setterinherited

Methods

map<TResult extends Object?>({required TResult start(TestStartRunnerEvent value), required TResult allSuites(TestAllSuitesEvent value), required TResult suite(TestSuiteEvent value), required TResult debug(TestDebugEvent value), required TResult group(TestGroupEvent value), required TResult startTest(TestStartEvent value), required TResult message(TestMessageEvent value), required TResult error(TestErrorEvent value), required TResult testDone(TestDoneEvent value), required TResult done(TestRunnerDoneEvent value), required TResult exit(TestExitEvent value)}) → TResult

Available on TestEvent, provided by the TestEventPatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>({TResult? start(TestStartRunnerEvent value)?, TResult? allSuites(TestAllSuitesEvent value)?, TResult? suite(TestSuiteEvent value)?, TResult? debug(TestDebugEvent value)?, TResult? group(TestGroupEvent value)?, TResult? startTest(TestStartEvent value)?, TResult? message(TestMessageEvent value)?, TResult? error(TestErrorEvent value)?, TResult? testDone(TestDoneEvent value)?, TResult? done(TestRunnerDoneEvent value)?, TResult? exit(TestExitEvent value)?}) → TResult?

Available on TestEvent, provided by the TestEventPatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>({TResult start(TestStartRunnerEvent value)?, TResult allSuites(TestAllSuitesEvent value)?, TResult suite(TestSuiteEvent value)?, TResult debug(TestDebugEvent value)?, TResult group(TestGroupEvent value)?, TResult startTest(TestStartEvent value)?, TResult message(TestMessageEvent value)?, TResult error(TestErrorEvent value)?, TResult testDone(TestDoneEvent value)?, TResult done(TestRunnerDoneEvent value)?, TResult exit(TestExitEvent value)?, required TResult orElse()}) → TResult

Available on TestEvent, provided by the TestEventPatterns extension

A variant of map that fallback to returning orElse.
maybeWhen<TResult extends Object?>({TResult start(String protocolVersion, String? runnerVersion, int pid, int time)?, TResult allSuites(int count, int time)?, TResult suite(TestSuite suite, int time)?, TResult debug(int suiteID, String? observatory, String? remoteDebugger, int time)?, TResult group(TestGroup group, int time)?, TResult startTest(Test test, int time)?, TResult message(int testID, String messageType, String message, int time)?, TResult error(int testID, String error, String stackTrace, bool isFailure, int time)?, TResult testDone(int testID, TestResult result, bool hidden, bool skipped, int time)?, TResult done(bool? success, int time)?, TResult exit(int exitCode, int time)?, required TResult orElse()}) → TResult

Available on TestEvent, provided by the TestEventPatterns extension

A variant of when that fallback to an orElse callback.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serializes this TestEvent to a JSON map.
inherited
toString() String
A string representation of this object.
inherited
when<TResult extends Object?>({required TResult start(String protocolVersion, String? runnerVersion, int pid, int time), required TResult allSuites(int count, int time), required TResult suite(TestSuite suite, int time), required TResult debug(int suiteID, String? observatory, String? remoteDebugger, int time), required TResult group(TestGroup group, int time), required TResult startTest(Test test, int time), required TResult message(int testID, String messageType, String message, int time), required TResult error(int testID, String error, String stackTrace, bool isFailure, int time), required TResult testDone(int testID, TestResult result, bool hidden, bool skipped, int time), required TResult done(bool? success, int time), required TResult exit(int exitCode, int time)}) → TResult

Available on TestEvent, provided by the TestEventPatterns extension

A switch-like method, using callbacks.
whenOrNull<TResult extends Object?>({TResult? start(String protocolVersion, String? runnerVersion, int pid, int time)?, TResult? allSuites(int count, int time)?, TResult? suite(TestSuite suite, int time)?, TResult? debug(int suiteID, String? observatory, String? remoteDebugger, int time)?, TResult? group(TestGroup group, int time)?, TResult? startTest(Test test, int time)?, TResult? message(int testID, String messageType, String message, int time)?, TResult? error(int testID, String error, String stackTrace, bool isFailure, int time)?, TResult? testDone(int testID, TestResult result, bool hidden, bool skipped, int time)?, TResult? done(bool? success, int time)?, TResult? exit(int exitCode, int time)?}) → TResult?

Available on TestEvent, provided by the TestEventPatterns extension

A variant of when that fallback to returning null

Operators

operator ==(Object other) bool
The equality operator.
inherited