Skip to content

Commit

Permalink
Merge pull request #75 from apex-dev-tools/test-setup-methods
Browse files Browse the repository at this point in the history
Exclude test setup methods from results
  • Loading branch information
pwrightcertinia authored Nov 20, 2024
2 parents f77ab25 + 17066b4 commit a3ab27b
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 25 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# test-runner - Changelog

## 3.1.3 - 2024-11-20

* Exclude `@testSetup` methods from `ApexTestResult` queries.

## 3.1.2 - 2024-04-08

* Set minimum timeout to 30s on polling requests.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apexdevtools/test-runner",
"version": "3.1.2",
"version": "3.1.3",
"description": "Apex parallel test runner with reliability goodness",
"author": {
"name": "Apex Dev Tools Team",
Expand Down
2 changes: 1 addition & 1 deletion src/collector/ResultCollector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class ResultCollector {
): Promise<ApexTestResult[]> {
return await QueryHelper.instance(connection).query<ApexTestResult>(
'ApexTestResult',
`AsyncApexJobId='${testRunId}'`,
`AsyncApexJobId='${testRunId}' AND IsTestSetup=FALSE`,
ApexTestResultFields.join(', ')
);
}
Expand Down
31 changes: 19 additions & 12 deletions src/model/ApexTestResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,26 @@
* Copyright (c) 2019, FinancialForce.com, inc. All rights reserved.
*/

/*
Unselected fields:
ApexLogId: string;
ApexTestRunResultId: string;
IsTestSetup: boolean;
*/

export const ApexTestResultFields = [
'Id',
'QueueItemId',
'ApexClass.Id',
'ApexClass.Name',
'ApexClass.NamespacePrefix',
'AsyncApexJobId',
'Outcome',
'MethodName',
'Id',
'Message',
'StackTrace',
'MethodName',
'Outcome',
'QueueItemId',
'RunTime',
'StackTrace',
'TestTimestamp',
'ApexClass.Id',
'ApexClass.Name',
'ApexClass.NamespacePrefix',
];

export type Outcome = 'Pass' | 'Fail' | 'CompileFail' | 'Skip';
Expand All @@ -30,17 +37,17 @@ export interface ApexClass {
}

export interface BaseTestResult {
Outcome: Outcome;
ApexClass: ApexClass;
MethodName: string;
Message: string | null;
StackTrace: string | null;
MethodName: string;
Outcome: Outcome;
RunTime: number;
StackTrace: string | null;
TestTimestamp: string;
}

export interface ApexTestResult extends BaseTestResult {
AsyncApexJobId: string;
Id: string;
QueueItemId: string;
AsyncApexJobId: string;
}
28 changes: 18 additions & 10 deletions src/model/ApexTestRunResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,39 @@
* Copyright (c) 2019, FinancialForce.com, inc. All rights reserved.
*/

/*
Unselected fields:
IsAllTests boolean;
JobName string;
Source string;
TestSetupTime: number;
*/

export const ApexTestRunResultFields = [
'AsyncApexJobId',
'StartTime',
'EndTime',
'Status',
'TestTime',
'UserId',
'ClassesCompleted',
'ClassesEnqueued',
'EndTime',
'MethodsCompleted',
'MethodsEnqueued',
'MethodsFailed',
'StartTime',
'Status',
'TestTime',
'UserId',
];

export interface ApexTestRunResult {
Id?: string;
AsyncApexJobId: string;
StartTime: string;
EndTime: string;
Status: string;
TestTime: number;
UserId: string;
ClassesCompleted: number;
ClassesEnqueued: number;
EndTime: string;
MethodsCompleted: number;
MethodsEnqueued: number;
MethodsFailed: number;
StartTime: string;
Status: string;
TestTime: number;
UserId: string;
}
2 changes: 1 addition & 1 deletion src/runner/TestRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ export class AsyncTestRunner implements TestRunner {
private async testResults(testRunId: string): Promise<ApexTestResult[]> {
return this._queryHelper.query<ApexTestResult>(
'ApexTestResult',
`AsyncApexJobId='${testRunId}'`,
`AsyncApexJobId='${testRunId}' AND IsTestSetup=FALSE`,
ApexTestResultFields.join(', ')
);
}
Expand Down

0 comments on commit a3ab27b

Please sign in to comment.