Skip to content

Commit

Permalink
show error stack trace as well
Browse files Browse the repository at this point in the history
  • Loading branch information
akshita31 committed May 24, 2018
1 parent a0eeb96 commit 168ede3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/observers/DotnetTestLoggerObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,13 @@ export default class DotNetTestLoggerObserver extends BaseLoggerObserver {
this.logger.appendLine(`Outcome: ${processOutcome(result.Outcome)}`);
if (result.ErrorMessage) {
this.logger.appendLine(`Error Message: ${result.ErrorMessage}`);

}

if (result.ErrorStackTrace) {
this.logger.appendLine(`Error StackTrace: ${result.ErrorStackTrace}`);
}

this.logger.appendLine();
this.logger.decreaseIndent();
}
Expand Down
10 changes: 5 additions & 5 deletions test/unitTests/logging/DotnetTestLoggerObserver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ suite(`${DotNetTestLoggerObserver.name}`, () => {
suite(`${ReportDotNetTestResults.name}`, () => {
let event = new ReportDotNetTestResults(
[
getDotNetTestResults("foo", "failed", "assertion failed", ""),
getDotNetTestResults("failinator", "failed", "error occured", ""),
getDotNetTestResults("foo", "failed", "assertion failed", "stacktrace1"),
getDotNetTestResults("failinator", "failed", "error occured", "stacktrace2"),
getDotNetTestResults("bar", "skipped", "", ""),
getDotNetTestResults("passinator", "passed", "", ""),
]);
Expand All @@ -77,10 +77,10 @@ suite(`${DotNetTestLoggerObserver.name}`, () => {
expect(appendedMessage).to.contain(`Total tests: 4. Passed: 1. Failed: 2. Skipped: 1`);
});

test('Displays the error message if any is present', () => {
test('Displays the error message and error stack trace if any is present', () => {
observer.post(event);
expect(appendedMessage).to.contain("foo:\n Outcome: Failed\n Error Message: assertion failed");
expect(appendedMessage).to.contain("failinator:\n Outcome: Failed\n Error Message: error occured");
expect(appendedMessage).to.contain("foo:\n Outcome: Failed\n Error Message: assertion failed\n Error StackTrace: stacktrace1");
expect(appendedMessage).to.contain("failinator:\n Outcome: Failed\n Error Message: error occured\n Error StackTrace: stacktrace2");
});
});
});
Expand Down

0 comments on commit 168ede3

Please sign in to comment.