@salesforce/apex-node
Version:
Salesforce JS library for Apex
74 lines (73 loc) • 3.53 kB
TypeScript
import { Connection } from '@salesforce/core';
import { CancellationToken, Progress } from '../common';
import { AsyncTestRun } from '../streaming';
import { ApexTestProgressValue, ApexTestQueueItem, ApexTestResult, ApexTestRunResult, AsyncTestArrayConfiguration, AsyncTestConfiguration, TestResult, TestRunIdResult } from './types';
import { Duration } from '@salesforce/kit';
export declare class AsyncTests {
readonly connection: Connection;
private readonly codecoverage;
private readonly logger;
constructor(connection: Connection);
/**
* Asynchronous Test Runs
* @param options test options
* @param codeCoverage should report code coverage
* @param exitOnTestRunId should not wait for test run to complete, return test run id immediately
* @param progress progress reporter
* @param token cancellation token
* @param timeout Duration to wait before returning a TestRunIdResult. If the polling client times out,
* the method will return the test run ID so you can retrieve results later.
*/
runTests(options: AsyncTestConfiguration | AsyncTestArrayConfiguration, codeCoverage?: boolean, exitOnTestRunId?: boolean, progress?: Progress<ApexTestProgressValue>, token?: CancellationToken, timeout?: Duration): Promise<TestResult | TestRunIdResult>;
private writeResultsToFile;
/**
* Report Asynchronous Test Run Results
* @param testRunId test run id
* @param codeCoverage should report code coverages
* @param token cancellation token
*/
reportAsyncResults(testRunId: string, codeCoverage?: boolean, token?: CancellationToken): Promise<TestResult>;
checkRunStatus(testRunId: string, progress?: Progress<ApexTestProgressValue>): Promise<{
testsComplete: boolean;
testRunSummary: ApexTestRunResult;
}>;
/**
* Format the results of a completed asynchronous test run
* @param asyncRunResult TestQueueItem and RunId for an async run
* @param commandStartTime start time for the async test run
* @param codeCoverage should report code coverages
* @param testRunSummary test run summary
* @param progress progress reporter
* @returns
*/
formatAsyncResults(asyncRunResult: AsyncTestRun, commandStartTime: number, codeCoverage: boolean, testRunSummary: ApexTestRunResult, progress?: Progress<ApexTestProgressValue>): Promise<TestResult>;
getAsyncTestResults(testQueueResult: ApexTestQueueItem): Promise<ApexTestResult[]>;
/**
* @returns Convert FlowTest result to ApexTestResult type
*/
private convertFlowTestResult;
private buildAsyncTestResults;
/**
* Abort test run with test run id
* @param testRunId
* @param progress
*/
abortTestRun(testRunId: string, progress?: Progress<ApexTestProgressValue>): Promise<void>;
private getTestRunRequestAction;
/**
* @returns A boolean indicating if the org's api version supports the test setup feature.
*/
supportsTestSetupFeature(): Promise<boolean>;
/**
* @returns A boolean indicating if this is running FlowTest.
*/
isJobIdForFlowTestRun(testRunId: string): Promise<boolean>;
/**
* @returns A connection based on the current api version and the max api version.
*/
defineApiVersion(): Promise<Connection>;
/**
* @returns A new connection similar to the current one but with a new api version.
*/
cloneConnectionWithNewVersion(newVersion: string): Promise<Connection>;
}