Skip to content

Commit 20c9360

Browse files
Merge pull request #1436 from DustinCampbell/improve-test-output
Add summary line after test run
2 parents 64d1034 + dabe988 commit 20c9360

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

src/features/dotnetTest.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,27 @@ export function runDotnetTest(testMethod: string, fileName: string, testFramewor
5555

5656
serverUtils.runTest(server, request)
5757
.then(response => {
58-
if (response.Pass) {
59-
output.appendLine('Test passed \n');
60-
}
61-
else {
62-
output.appendLine('Test failed \n');
58+
const totalTests = response.Results.length;
59+
60+
let totalPassed = 0, totalFailed = 0, totalSkipped = 0;
61+
for (let result of response.Results) {
62+
switch (result.Outcome) {
63+
case protocol.V2.TestOutcomes.Failed:
64+
totalFailed += 1;
65+
break;
66+
case protocol.V2.TestOutcomes.Passed:
67+
totalPassed += 1;
68+
break;
69+
case protocol.V2.TestOutcomes.Skipped:
70+
totalSkipped += 1;
71+
break;
72+
}
6373
}
6474

75+
output.appendLine('');
76+
output.appendLine(`Total tests: ${totalTests}. Passed: ${totalPassed}. Failed: ${totalFailed}. Skipped: ${totalSkipped}`);
77+
output.appendLine('');
78+
6579
disposable.dispose();
6680
},
6781
reason => {

src/omnisharp/protocol.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,15 @@ export namespace V2 {
538538
TestFrameworkName: string;
539539
}
540540

541-
export interface DotNetResult {
541+
export module TestOutcomes {
542+
export const None = 'none';
543+
export const Passed = 'passed';
544+
export const Failed = 'failed';
545+
export const Skipped = 'skipped';
546+
export const NotFound = 'notfound';
547+
}
548+
549+
export interface DotNetTestResult {
542550
MethodName: string;
543551
Outcome: string;
544552
ErrorMessage: string;
@@ -548,6 +556,7 @@ export namespace V2 {
548556
export interface RunTestResponse {
549557
Failure: string;
550558
Pass: boolean;
559+
Results: DotNetTestResult[];
551560
}
552561

553562
export interface TestMessageEvent {

0 commit comments

Comments
 (0)