Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add summary line after test run #1436

Merged
merged 1 commit into from
Apr 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions src/features/dotnetTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,27 @@ export function runDotnetTest(testMethod: string, fileName: string, testFramewor

serverUtils.runTest(server, request)
.then(response => {
if (response.Pass) {
output.appendLine('Test passed \n');
}
else {
output.appendLine('Test failed \n');
const totalTests = response.Results.length;

let totalPassed = 0, totalFailed = 0, totalSkipped = 0;
for (let result of response.Results) {
switch (result.Outcome) {
case protocol.V2.TestOutcomes.Failed:
totalFailed += 1;
break;
case protocol.V2.TestOutcomes.Passed:
totalPassed += 1;
break;
case protocol.V2.TestOutcomes.Skipped:
totalSkipped += 1;
break;
}
}

output.appendLine('');
output.appendLine(`Total tests: ${totalTests}. Passed: ${totalPassed}. Failed: ${totalFailed}. Skipped: ${totalSkipped}`);
output.appendLine('');

disposable.dispose();
},
reason => {
Expand Down
11 changes: 10 additions & 1 deletion src/omnisharp/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,15 @@ export namespace V2 {
TestFrameworkName: string;
}

export interface DotNetResult {
export module TestOutcomes {
export const None = 'none';
export const Passed = 'passed';
export const Failed = 'failed';
export const Skipped = 'skipped';
export const NotFound = 'notfound';
}

export interface DotNetTestResult {
MethodName: string;
Outcome: string;
ErrorMessage: string;
Expand All @@ -548,6 +556,7 @@ export namespace V2 {
export interface RunTestResponse {
Failure: string;
Pass: boolean;
Results: DotNetTestResult[];
}

export interface TestMessageEvent {
Expand Down