Skip to content

Commit

Permalink
Add tests for parsing parallel XCTest run output
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
plemarquand committed Mar 3, 2025
1 parent 7b60f35 commit 9205c5f
Show file tree
Hide file tree
Showing 2 changed files with 485 additions and 420 deletions.
12 changes: 6 additions & 6 deletions test/integration-tests/testexplorer/MockTestRunState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export enum TestStatus {
skipped = "skipped",
}

/** TestItem */
interface TestItem {
/** TestRunTestItem */
export interface TestRunTestItem {
name: string;
status: TestStatus;
issues?: {
Expand All @@ -40,11 +40,11 @@ interface TestItem {

interface ITestItemFinder {
getIndex(id: string): number;
tests: TestItem[];
tests: TestRunTestItem[];
}

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

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

public testItemFinder: ITestItemFinder;

get tests(): TestItem[] {
get tests(): TestRunTestItem[] {
return this.testItemFinder.tests;
}

Expand Down
Loading

0 comments on commit 9205c5f

Please sign in to comment.