Skip to content

Commit 280d6bf

Browse files
author
Kartik Raj
authored
Update status of test suite when all tests pass (parametric tests) (#4771)
* support parametric tests * news entry
1 parent 81a079c commit 280d6bf

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

news/1 Enhancements/4727.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update status of test suite when all tests pass (parametric tests)

src/client/unittests/common/services/testResultsService.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ export class TestResultsService implements ITestResultsService {
3333
}
3434
}
3535
});
36+
tests.testSuites.forEach(item => {
37+
if (typeof item.testSuite.passed === 'boolean') {
38+
if (status === TestStatus.Pass ? item.testSuite.passed : !item.testSuite.passed) {
39+
visitParentsRecursive(tests, item.testSuite, visitor);
40+
}
41+
}
42+
});
43+
tests.testFunctions.forEach(item => {
44+
if (typeof item.testFunction.passed === 'boolean') {
45+
if (status === TestStatus.Pass ? item.testFunction.passed : !item.testFunction.passed) {
46+
visitParentsRecursive(tests, item.testFunction, visitor);
47+
}
48+
}
49+
});
3650
}
3751
private updateTestFolderResults(testFolder: TestFolder): void {
3852
let totalTime = 0;

src/client/unittests/explorer/testTreeViewItem.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ export class TestTreeItem extends TreeItem {
7676
return '';
7777
}
7878
if (this.testType !== TestType.testFunction) {
79+
if (result.functionsPassed === undefined) {
80+
return '';
81+
}
7982
return `${result.functionsFailed} failed, ${result.functionsPassed} passed in ${+result.time.toFixed(3)} seconds`;
8083
}
8184
switch (this.data.status) {

src/client/unittests/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ export type TestDataItem = TestWorkspaceFolder | TestFolder | TestFile | TestSui
160160

161161
export class TestWorkspaceFolder {
162162
public status?: TestStatus;
163+
public time?: number;
164+
public functionsPassed?: number;
165+
public functionsFailed?: number;
166+
public functionsDidNotRun?: number;
163167
constructor(public readonly workspaceFolder: WorkspaceFolder) { }
164168
public get resource(): Uri {
165169
return this.workspaceFolder.uri;

0 commit comments

Comments
 (0)