@salesforce/apex-node
Version:
Salesforce JS library for Apex
88 lines (87 loc) • 3.97 kB
TypeScript
import { Connection } from '@salesforce/core';
import { ApexTestProgressValue, AsyncTestArrayConfiguration, AsyncTestConfiguration, OutputDirConfig, SyncTestConfiguration, TestLevel, TestResult, TestRunIdResult, TestSuiteMembershipRecord } from './types';
import { CancellationToken, Progress } from '../common';
import { AsyncTests } from './asyncTests';
import { Writable } from 'node:stream';
import { Duration } from '@salesforce/kit';
export declare class TestService {
private readonly connection;
readonly asyncService: AsyncTests;
private readonly syncService;
constructor(connection: Connection);
/**
* Retrieve all suites in org
* @returns list of Suites in org
*/
retrieveAllSuites(): Promise<{
id: string;
TestSuiteName: string;
}[]>;
private retrieveSuiteId;
/**
* Retrive the ids for the given suites
* @param suitenames names of suites
* @returns Ids associated with each suite
*/
private getOrCreateSuiteIds;
/**
* Retrieves the test classes in a given suite
* @param suitename name of suite
* @param suiteId id of suite
* @returns list of test classes in the suite
*/
getTestsInSuite(suitename?: string, suiteId?: string): Promise<TestSuiteMembershipRecord[]>;
/**
* Returns the associated Ids for each given Apex class
* @param testClasses list of Apex class names
* @returns the associated ids for each Apex class
*/
getApexClassIds(testClasses: string[]): Promise<string[]>;
/**
* Builds a test suite with the given test classes. Creates the test suite if it doesn't exist already
* @param suitename name of suite
* @param testClasses
*/
buildSuite(suitename: string, testClasses: string[]): Promise<void>;
/**
* Synchronous Test Runs
* @param options Synchronous Test Runs configuration
* @param codeCoverage should report code coverage
* @param token cancellation token
*/
runTestSynchronous(options: SyncTestConfiguration, codeCoverage?: boolean, token?: CancellationToken): Promise<TestResult | TestRunIdResult>;
/**
* Asynchronous Test Runs
* @param options test options
* @param codeCoverage should report code coverage
* @param immediatelyReturn should not wait for test run to complete, return test run id immediately
* @param progress progress reporter
* @param token cancellation token
* @param timeout
*/
runTestAsynchronous(options: AsyncTestConfiguration | AsyncTestArrayConfiguration, codeCoverage?: boolean, immediatelyReturn?: boolean, progress?: Progress<ApexTestProgressValue>, token?: CancellationToken, timeout?: Duration): Promise<TestResult | TestRunIdResult>;
/**
* 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>;
/**
*
* @param result test result
* @param outputDirConfig config for result files
* @param codeCoverage should report code coverage
* @returns list of result files created
*/
writeResultFiles(result: TestResult | TestRunIdResult, outputDirConfig: OutputDirConfig, codeCoverage?: boolean): Promise<string[]>;
buildSyncPayload(testLevel: TestLevel, tests?: string, classnames?: string, category?: string): Promise<SyncTestConfiguration>;
buildAsyncPayload(testLevel: TestLevel, tests?: string, classNames?: string, suiteNames?: string, category?: string): Promise<AsyncTestConfiguration | AsyncTestArrayConfiguration>;
private buildAsyncClassPayload;
private buildClassPayloadForFlow;
private buildTestPayload;
private buildTestPayloadForFlow;
private runPipeline;
createStream(filePath: string): Writable;
private isFlowTest;
}