logFailureAuto<T> method
void
logFailureAuto<T>({
- required String testName,
- DateTime? startTime,
- T? result,
- Object? input,
- Object? exception,
- StackTrace? stackTrace,
Implementation
void logFailureAuto<T>({
required String testName,
DateTime? startTime,
T? result,
Object? input,
Object? exception,
StackTrace? stackTrace,
}) {
final start = DateTime.now();
final end = DateTime.now();
final reason = exception is TestFailure
? FailureFormatter.format(
condition: 'Check failed assertion',
actualResult: result,
input: input,
error: exception,
)
: exception?.toString();
_writer.add(
TestLogEntry<T>(
testName: testName,
startTime: startTime ?? start,
endTime: end,
status: 'failed',
message: 'Test failed.',
result: result,
exception: reason,
stackTrace: stackTrace?.toString(),
),
);
}