This commit is contained in:
Akshita Agarwal 2018-05-22 15:01:52 -07:00
Родитель aec919fa1d
Коммит 44ecf6fb28
1 изменённых файлов: 21 добавлений и 5 удалений

Просмотреть файл

@ -40,12 +40,12 @@ export default class DotNetTestLoggerObserver extends BaseLoggerObserver {
}
private handleDotnetTestDebugStart(event: DotNetTestDebugStart) {
this.logger.appendLine(`Debugging method ${event.testMethod}...`);
this.logger.appendLine(`----- Debugging test method ${event.testMethod} -----`);
this.logger.appendLine('');
}
private handleDotnetTestRunStart(event: DotNetTestRunStart): any {
this.logger.appendLine(`Running test ${event.testMethod}...`);
this.logger.appendLine(`----- Running test method "${event.testMethod}" -----`);
this.logger.appendLine('');
}
@ -54,12 +54,14 @@ export default class DotNetTestLoggerObserver extends BaseLoggerObserver {
}
private handleReportDotnetTestResults(event: ReportDotNetTestResults) {
this.logger.appendLine("----- Test Execution Summary -----");
this.logger.appendLine('');
const results = event.results;
const totalTests = results.length;
let totalPassed = 0, totalFailed = 0, totalSkipped = 0;
for (let result of results) {
this.logger.appendLine(`${result.MethodName}: ${result.Outcome}`);
this.logTestResult(result);
switch (result.Outcome) {
case protocol.V2.TestOutcomes.Failed:
totalFailed += 1;
@ -73,8 +75,22 @@ export default class DotNetTestLoggerObserver extends BaseLoggerObserver {
}
}
this.logger.appendLine('');
this.logger.appendLine(`Total tests: ${totalTests}. Passed: ${totalPassed}. Failed: ${totalFailed}. Skipped: ${totalSkipped}`);
this.logger.appendLine('');
}
}
private logTestResult(result: protocol.V2.DotNetTestResult) {
this.logger.appendLine(`${result.MethodName}: ${processOutcome(result.Outcome)}`);
this.logger.increaseIndent();
this.logger.appendLine(`Outcome: ${processOutcome(result.Outcome)}`);
if (result.ErrorMessage) {
this.logger.appendLine(`Error Message: ${result.ErrorMessage}`);
}
this.logger.appendLine();
this.logger.decreaseIndent();
}
}
function processOutcome(input: string) {
return input.charAt(0).toUpperCase() + input.slice(1);
}