Skip to content

Commit b9713fd

Browse files
authored
Add tests for parsing parallel XCTest run output (#1418)
When performing a parallel XCTest run we first parse the terminal output, then parse the xUnit XML output and merge the two data sets together to create the run results. This merging was not being tested at the unit test level, only at the integration test level, which lead to a subtle and occasional bug, #1334 (fixed in #1343). As a followup, update the existing XCTestOutputParser tests to test both regular and parallel test run output. xUnit XML is synthesized from the expected results and fed in to the `TestXUnitParser` to modify the test's `TestRunState` just as it is in the extension.
1 parent d2990b3 commit b9713fd

File tree

2 files changed

+485
-420
lines changed

2 files changed

+485
-420
lines changed

test/integration-tests/testexplorer/MockTestRunState.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export enum TestStatus {
2424
skipped = "skipped",
2525
}
2626

27-
/** TestItem */
28-
interface TestItem {
27+
/** TestRunTestItem */
28+
export interface TestRunTestItem {
2929
name: string;
3030
status: TestStatus;
3131
issues?: {
@@ -40,11 +40,11 @@ interface TestItem {
4040

4141
interface ITestItemFinder {
4242
getIndex(id: string): number;
43-
tests: TestItem[];
43+
tests: TestRunTestItem[];
4444
}
4545

4646
export class DarwinTestItemFinder implements ITestItemFinder {
47-
tests: TestItem[] = [];
47+
tests: TestRunTestItem[] = [];
4848
getIndex(id: string): number {
4949
const index = this.tests.findIndex(item => item.name === id);
5050
if (index === -1) {
@@ -56,7 +56,7 @@ export class DarwinTestItemFinder implements ITestItemFinder {
5656
}
5757

5858
export class NonDarwinTestItemFinder implements ITestItemFinder {
59-
tests: TestItem[] = [];
59+
tests: TestRunTestItem[] = [];
6060
getIndex(id: string): number {
6161
const index = this.tests.findIndex(item => item.name.endsWith(id));
6262
if (index === -1) {
@@ -81,7 +81,7 @@ export class TestRunState implements ITestRunState {
8181

8282
public testItemFinder: ITestItemFinder;
8383

84-
get tests(): TestItem[] {
84+
get tests(): TestRunTestItem[] {
8585
return this.testItemFinder.tests;
8686
}
8787

0 commit comments

Comments
 (0)