loadmill
Version:
A node.js module for running load tests and functional tests on loadmill.com
100 lines (99 loc) • 3.07 kB
TypeScript
import './polyfills';
import { FLOW_STATUS } from './utils';
export = Loadmill;
declare function Loadmill(options: Loadmill.LoadmillOptions): {
run(config: Loadmill.Configuration, paramsOrCallback?: Loadmill.ParamsOrCallback, callback?: Loadmill.Callback): Promise<string>;
wait(testDefOrId: string | Loadmill.TestDef, callback?: Loadmill.Callback): Promise<Loadmill.TestResult>;
runTestPlan(testPlan: Loadmill.TestPlanDef, params: Loadmill.Params): Promise<Loadmill.TestDef | undefined>;
junitReport(testResult: Loadmill.TestResult, path?: string | undefined): Promise<void>;
mochawesomeReport(testResult: Loadmill.TestResult, path?: string | undefined): Promise<void>;
};
declare namespace Loadmill {
export interface LoadmillOptions {
token: string;
}
export interface TestDef {
id: string;
type: TYPES;
}
export interface TestSuiteDef {
id: string;
description?: string;
options?: TestSuiteOptions;
}
export interface TestPlanDef {
id: string;
description?: string;
options?: TestPlanOptions;
}
export interface TestSuiteOptions {
additionalDescription?: string;
labels?: string[] | null;
failGracefully?: boolean;
pool?: string;
parametersFile?: string;
}
export interface TestPlanOptions {
additionalDescription?: string;
labels?: string[] | null;
labelsExpression?: string;
fetchFlowRuns?: boolean;
pool?: string;
tags?: string[] | null;
parallel?: number | string;
branch?: string;
maxFlakyFlowRetries?: number | string;
parametersFile?: string;
inlineParameterOverride?: boolean;
apiCatalogService?: string;
turboParallel?: boolean;
}
export interface TestResult extends TestDef {
url: string;
passed: boolean;
description: string;
flowRuns?: Array<FlowRun>;
testSuitesRuns?: Array<TestResult>;
status?: string;
startTime: string;
endTime: string;
error?: SuiteError;
}
export interface FlowRun {
id: string;
status: string;
description: string;
flowStatus: FLOW_STATUS;
duration: number;
retries?: number;
}
type SuiteError = {
message: string;
};
export type Configuration = object | string | any;
export type Params = {
[key: string]: string;
};
export type ParamsOrCallback = Params | Callback;
export type Callback = {
(err: Error | null, result: any): void;
} | undefined;
export type Histogram = {
[reason: string]: number;
};
export type TestFailures = {
[reason: string]: {
[histogram: string]: Histogram;
};
};
export type Args = {
verbose: boolean;
colors?: boolean;
};
export enum TYPES {
LOAD = "load",
SUITE = "test-suite",
TEST_PLAN = "test-plan"
}
export {};
}