writeAppConsoleLog function
Implementation
Future<String> writeAppConsoleLog(EnsembleTestContext context) {
return RunnerBenchmark.future('diagnostic', 'writeAppConsoleLog', () {
final buffer = StringBuffer();
if (context.runtime.attemptCount > 1) {
buffer.writeln(
'--- Attempt ${context.runtime.attemptNumber} of '
'${context.runtime.attemptCount} ---',
);
}
for (final line in context.runtime.consoleLogs) {
buffer.writeln(line);
}
if (context.runtime.flutterErrors.isNotEmpty) {
if (buffer.isNotEmpty) {
buffer.writeln();
}
buffer.writeln('--- flutter errors ---');
for (final error in context.runtime.flutterErrors) {
buffer.writeln(error);
}
}
return context.logger.writeLogFile(
testId: context.runtime.artifactFilePrefix(context.testCase.id),
name: 'app_console',
content: buffer.isEmpty ? '<no console output>\n' : buffer.toString(),
extension: 'log',
);
});
}