UNPKG

@gatling.io/core

Version:

Gatling JS is a JavaScript/TypeScript interface for the [Gatling load testing tool](https://gatling.io/).

128 lines (127 loc) 4.96 kB
import JvmPauses = io.gatling.javaapi.core.pause.Pauses; import JvmPauseType = io.gatling.javaapi.core.PauseType; import { Duration } from "../utils/duration"; import { SessionTo } from "../session"; export type PauseType = "Disabled" | "Constant" | "Exponential" | { type: "NormalWithPercentageDuration"; stdDev: number; } | { type: "NormalWithStdDevDuration"; stdDev: Duration; } | { type: "Custom"; f: SessionTo<number>; } | { type: "UniformPercentage"; plusOrMinus: number; } | { type: "UniformDuration"; plusOrMinus: Duration; }; export declare const toJvmPauseType: (pauseType: PauseType) => JvmPauseType; export interface PauseFunction<T extends Pauses<T>> { /** * Attach a pause * * @param duration - the pause duration, in seconds or with an explicit time unit * @returns a new StructureBuilder */ (duration: Duration): T; /** * Attach a pause as a Gatling Expression Language string. This expression must resolve to either a number, then the * unit will be seconds, or an object with an explicit time unit. * * @param duration - the pause duration as a Gatling Expression Language string * @returns a new StructureBuilder */ (duration: string): T; /** * Attach a pause * * @param duration - the pause duration as a function * @returns a new StructureBuilder */ (duration: SessionTo<Duration>): T; /** * Attach a pause * * @param duration - the pause duration, in seconds or with an explicit time unit * @param pauseType - the type of pause * @returns a new StructureBuilder */ (duration: Duration, pauseType: PauseType): T; /** * Attach a pause as a Gatling Expression Language string. This expression must resolve to either a number, then the * unit will be seconds, or an object with an explicit time unit. * * @param duration - the pause duration as a Gatling Expression Language string * @param pauseType - the type of pause * @returns a new StructureBuilder */ (duration: string, pauseType: PauseType): T; /** * Attach a pause * * @param duration - the pause duration as a function * @param pauseType - the type of pause * @returns a new StructureBuilder */ (duration: SessionTo<Duration>, pauseType: PauseType): T; /** * Attach a pause computed randomly between 2 values * * @param min the pause minimum, in seconds or with an explicit time unit * @param max the pause maximum, in seconds or with an explicit time unit * @return a new StructureBuilder */ (min: Duration, max: Duration): T; /** * Attach a pause computed randomly between 2 values as a Gatling Expression Language string. These expressions must * resolve to either a number, then the unit will be seconds, or an object with an explicit time unit. * * @param min the pause minimum as a Gatling Expression Language string * @param max the pause maximum as a Gatling Expression Language string * @return a new StructureBuilder */ (min: string, max: string): T; /** * Attach a pause computed randomly between 2 values * * @param min the pause minimum as a function * @param max the pause maximum as a function * @return a new StructureBuilder */ (min: SessionTo<Duration>, max: SessionTo<Duration>): T; /** * Attach a pause computed randomly between 2 values * * @param min the pause minimum, in seconds or with an explicit time unit * @param max the pause maximum, in seconds or with an explicit time unit * @param pauseType - the type of pause * @return a new StructureBuilder */ (min: Duration, max: Duration, pauseType: PauseType): T; /** * Attach a pause computed randomly between 2 values as a Gatling Expression Language string. These expressions must * resolve to either a number, then the unit will be seconds, or an object with an explicit time unit. * * @param min the pause minimum as a Gatling Expression Language string * @param max the pause maximum as a Gatling Expression Language string * @param pauseType - the type of pause * @return a new StructureBuilder */ (min: string, max: string, pauseType: PauseType): T; /** * Attach a pause computed randomly between 2 values * * @param min the pause minimum as a function * @param max the pause maximum as a function * @param pauseType - the type of pause * @return a new StructureBuilder */ (min: SessionTo<Duration>, max: SessionTo<Duration>, pauseType: PauseType): T; } export interface Pauses<T extends Pauses<T>> { pause: PauseFunction<T>; } export declare const pauseImpl: <J2, J1 extends JvmPauses<J2, any>, T extends Pauses<T>>(jvmGroups: J1, wrap: (wrapped: J2) => T) => PauseFunction<T>;