benchpress
- Version 2.0.0-beta.17
- Published
- 7 dependencies
- MIT license
Install
npm i benchpress
yarn add benchpress
pnpm add benchpress
Overview
Benchpress - a framework for e2e performance tests
Index
Classes
Classes
class ChromeDriverExtension
class ChromeDriverExtension extends WebDriverExtension {}
Set the following 'traceCategories' to collect metrics in Chrome: 'v8,blink.console,disabled-by-default-devtools.timeline,devtools.timeline'
In order to collect the frame rate related metrics, add 'benchmark' to the list above.
constructor
constructor(_driver: WebDriverAdapter, userAgent: string);
property BINDINGS
static readonly BINDINGS: Provider[];
method gc
gc: () => Promise<any>;
method perfLogFeatures
perfLogFeatures: () => PerfLogFeatures;
method readPerfLog
readPerfLog: () => Promise<any>;
method supports
supports: (capabilities: { [key: string]: any }) => boolean;
method timeBegin
timeBegin: (name: string) => Promise<any>;
method timeEnd
timeEnd: (name: string, restartName?: string) => Promise<any>;
class ConsoleReporter
class ConsoleReporter extends Reporter {}
A reporter for the console
constructor
constructor(_columnWidth: number, sampleDescription: any, _print: Function);
property BINDINGS
static readonly BINDINGS: Provider[];
property COLUMN_WIDTH
static readonly COLUMN_WIDTH: OpaqueToken;
property PRINT
static readonly PRINT: OpaqueToken;
method reportMeasureValues
reportMeasureValues: (measureValues: MeasureValues) => Promise<any>;
method reportSample
reportSample: ( completeSample: MeasureValues[], validSamples: MeasureValues[]) => Promise<any>;
class FirefoxDriverExtension
class FirefoxDriverExtension extends WebDriverExtension {}
constructor
constructor(_driver: WebDriverAdapter);
property BINDINGS
static readonly BINDINGS: Provider[];
method gc
gc: () => Promise<any>;
method perfLogFeatures
perfLogFeatures: () => PerfLogFeatures;
method readPerfLog
readPerfLog: () => Promise<any>;
method supports
supports: (capabilities: { [key: string]: any }) => boolean;
method timeBegin
timeBegin: (name: string) => Promise<any>;
method timeEnd
timeEnd: (name: string, restartName?: string) => Promise<any>;
class IOsDriverExtension
class IOsDriverExtension extends WebDriverExtension {}
constructor
constructor(_driver: WebDriverAdapter);
property BINDINGS
static readonly BINDINGS: Provider[];
method gc
gc: () => Promise<any>;
method perfLogFeatures
perfLogFeatures: () => PerfLogFeatures;
method readPerfLog
readPerfLog: () => Promise<any[]>;
method supports
supports: (capabilities: { [key: string]: any }) => boolean;
method timeBegin
timeBegin: (name: string) => Promise<any>;
method timeEnd
timeEnd: (name: string, restartName?: string) => Promise<any>;
class JsonFileReporter
class JsonFileReporter extends Reporter {}
A reporter that writes results into a json file.
constructor
constructor(sampleDescription: any, path: any, writeFile: any, now: any);
property BINDINGS
static readonly BINDINGS: Provider[];
property PATH
static readonly PATH: OpaqueToken;
method reportMeasureValues
reportMeasureValues: (measureValues: MeasureValues) => Promise<any>;
method reportSample
reportSample: ( completeSample: MeasureValues[], validSample: MeasureValues[]) => Promise<any>;
class MeasureValues
class MeasureValues {}
constructor
constructor(runIndex: number, timeStamp: Date, values: { [key: string]: any });
property runIndex
runIndex: number;
property timeStamp
timeStamp: Date;
property values
values: { [key: string]: any };
method toJson
toJson: () => { timeStamp: any; runIndex: number; values: { [key: string]: any };};
class Metric
abstract class Metric {}
A metric is measures values
method beginMeasure
beginMeasure: () => Promise<any>;
Starts measuring
method bindTo
static bindTo: (delegateToken: any) => Provider[];
method describe
describe: () => { [key: string]: any };
Describes the metrics provided by this metric implementation. (e.g. units, ...)
method endMeasure
endMeasure: (restart: boolean) => Promise<{ [key: string]: any }>;
Ends measuring and reports the data since the begin call.
Parameter restart
: Whether to restart right after this.
class MultiMetric
class MultiMetric extends Metric {}
constructor
constructor(_metrics: Metric[]);
method beginMeasure
beginMeasure: () => Promise<any>;
Starts measuring
method createBindings
static createBindings: (childTokens: any[]) => Provider[];
method describe
describe: () => { [key: string]: any };
Describes the metrics provided by this metric implementation. (e.g. units, ...)
method endMeasure
endMeasure: (restart: boolean) => Promise<{ [key: string]: any }>;
Ends measuring and reports the data since the begin call.
Parameter restart
: Whether to restart right after this.
class MultiReporter
class MultiReporter extends Reporter {}
constructor
constructor(reporters: any);
method createBindings
static createBindings: (childTokens: any[]) => Provider[];
method reportMeasureValues
reportMeasureValues: (values: MeasureValues) => Promise<any[]>;
method reportSample
reportSample: ( completeSample: MeasureValues[], validSample: MeasureValues[]) => Promise<any[]>;
class Options
class Options {}
property CAPABILITIES
static readonly CAPABILITIES: any;
property CAPTURE_FRAMES
static readonly CAPTURE_FRAMES: any;
property DEFAULT_DESCRIPTION
static readonly DEFAULT_DESCRIPTION: any;
property DEFAULT_PROVIDERS
static readonly DEFAULT_PROVIDERS: Provider[];
property EXECUTE
static readonly EXECUTE: any;
property FORCE_GC
static readonly FORCE_GC: any;
property MICRO_METRICS
static readonly MICRO_METRICS: any;
property NOW
static readonly NOW: any;
property PREPARE
static readonly PREPARE: any;
property RECEIVED_DATA
static readonly RECEIVED_DATA: any;
property REQUEST_COUNT
static readonly REQUEST_COUNT: any;
property SAMPLE_DESCRIPTION
static readonly SAMPLE_DESCRIPTION: any;
property SAMPLE_ID
static readonly SAMPLE_ID: any;
property USER_AGENT
static readonly USER_AGENT: any;
property WRITE_FILE
static readonly WRITE_FILE: any;
class PerfLogFeatures
class PerfLogFeatures {}
constructor
constructor({ render = false, gc = false, frameCapture = false, userTiming = false,}?: { render?: boolean; gc?: boolean; frameCapture?: boolean; userTiming?: boolean;});
property frameCapture
frameCapture: boolean;
property gc
gc: boolean;
property render
render: boolean;
property userTiming
userTiming: boolean;
class PerflogMetric
class PerflogMetric extends Metric {}
A metric that reads out the performance log
constructor
constructor( _driverExtension: WebDriverExtension, _setTimeout: Function, _microMetrics: { [key: string]: any }, _forceGc: boolean, _captureFrames: boolean, _receivedData: boolean, _requestCount: boolean);
Parameter driverExtension
Parameter setTimeout
Parameter microMetrics
Name and description of metrics provided via console.time / console.timeEnd
property BINDINGS
static readonly BINDINGS: Provider[];
property SET_TIMEOUT
static readonly SET_TIMEOUT: OpaqueToken;
method beginMeasure
beginMeasure: () => Promise<any>;
method describe
describe: () => { [key: string]: any };
method endMeasure
endMeasure: (restart: boolean) => Promise<{ [key: string]: any }>;
class RegressionSlopeValidator
class RegressionSlopeValidator extends Validator {}
A validator that checks the regression slope of a specific metric. Waits for the regression slope to be >=0.
constructor
constructor(sampleSize: any, metric: any);
property BINDINGS
static readonly BINDINGS: Provider[];
property METRIC
static readonly METRIC: OpaqueToken;
property SAMPLE_SIZE
static readonly SAMPLE_SIZE: OpaqueToken;
method describe
describe: () => { [key: string]: any };
method validate
validate: (completeSample: MeasureValues[]) => MeasureValues[];
class Reporter
abstract class Reporter {}
A reporter reports measure values and the valid sample.
method bindTo
static bindTo: (delegateToken: any) => Provider[];
method reportMeasureValues
reportMeasureValues: (values: MeasureValues) => Promise<any>;
method reportSample
reportSample: ( completeSample: MeasureValues[], validSample: MeasureValues[]) => Promise<any>;
class Runner
class Runner {}
The Runner is the main entry point for executing a sample run. It provides defaults, creates the injector and calls the sampler.
constructor
constructor(defaultBindings?: Provider[]);
method sample
sample: ({ id, execute, prepare, microMetrics, bindings,}: { id: string; execute?: any; prepare?: any; microMetrics?: any; bindings?: any;}) => Promise<SampleState>;
class SampleDescription
class SampleDescription {}
SampleDescription merges all available descriptions about a sample
constructor
constructor( id: string, descriptions: { [key: string]: any }[], metrics: { [key: string]: any });
property BINDINGS
static readonly BINDINGS: Provider[];
property description
description: { [key: string]: any };
property id
id: string;
property metrics
metrics: { [key: string]: any };
method toJson
toJson: () => { id: string; description: { [key: string]: any }; metrics: { [key: string]: any };};
class Sampler
class Sampler {}
The Sampler owns the sample loop: 1. calls the prepare/execute callbacks, 2. gets data from the metric 3. asks the validator for a valid sample 4. reports the new data to the reporter 5. loop until there is a valid sample
constructor
constructor({ driver, metric, reporter, validator, prepare, execute, now,}?: { driver?: WebDriverAdapter; metric?: Metric; reporter?: Reporter; validator?: Validator; prepare?: Function; execute?: Function; now?: Function;});
property BINDINGS
static readonly BINDINGS: Provider[];
method sample
sample: () => Promise<SampleState>;
class SampleState
class SampleState {}
constructor
constructor(completeSample: any[], validSample: any[]);
property completeSample
completeSample: any[];
property validSample
validSample: any[];
class SeleniumWebDriverAdapter
class SeleniumWebDriverAdapter extends WebDriverAdapter {}
Adapter for the selenium-webdriver.
constructor
constructor(_driver: any);
property PROTRACTOR_BINDINGS
static readonly PROTRACTOR_BINDINGS: Provider[];
method capabilities
capabilities: () => Promise<any>;
method executeAsyncScript
executeAsyncScript: (script: string) => Promise<any>;
method executeScript
executeScript: (script: string) => Promise<any>;
method logs
logs: (type: string) => Promise<any>;
method waitFor
waitFor: (callback: any) => Promise<any>;
class SizeValidator
class SizeValidator extends Validator {}
A validator that waits for the sample to have a certain size.
constructor
constructor(size: any);
property BINDINGS
static readonly BINDINGS: Provider[];
property SAMPLE_SIZE
static readonly SAMPLE_SIZE: any;
method describe
describe: () => { [key: string]: any };
method validate
validate: (completeSample: MeasureValues[]) => MeasureValues[];
class Validator
abstract class Validator {}
A Validator calculates a valid sample out of the complete sample. A valid sample is a sample that represents the population that should be observed in the correct way.
method bindTo
static bindTo: (delegateToken: any) => Provider[];
method describe
describe: () => { [key: string]: any };
Returns a Map that describes the properties of the validator (e.g. sample size, ...)
method validate
validate: (completeSample: MeasureValues[]) => MeasureValues[];
Calculates a valid sample out of the complete sample
class WebDriverAdapter
abstract class WebDriverAdapter {}
A WebDriverAdapter bridges API differences between different WebDriver clients, e.g. JS vs Dart Async vs Dart Sync webdriver. Needs one implementation for every supported WebDriver client.
method bindTo
static bindTo: (delegateToken: any) => Provider[];
method capabilities
capabilities: () => Promise<Map<string, any>>;
method executeAsyncScript
executeAsyncScript: (script: string) => Promise<any>;
method executeScript
executeScript: (script: string) => Promise<any>;
method logs
logs: (type: string) => Promise<any[]>;
method waitFor
waitFor: (callback: Function) => Promise<any>;
class WebDriverExtension
abstract class WebDriverExtension {}
A WebDriverExtension implements extended commands of the webdriver protocol for a given browser, independent of the WebDriverAdapter. Needs one implementation for every supported Browser.
method bindTo
static bindTo: (childTokens: any[]) => Provider[];
method gc
gc: () => Promise<any>;
method perfLogFeatures
perfLogFeatures: () => PerfLogFeatures;
method readPerfLog
readPerfLog: () => Promise<any[]>;
Format: - cat: category of the event - name: event name: 'script', 'gc', 'render', ... - ph: phase: 'B' (begin), 'E' (end), 'b' (nestable start), 'e' (nestable end), 'X' (Complete event) - ts: timestamp in ms, e.g. 12345 - pid: process id - args: arguments, e.g. {heapSize: 1234}
Based on [Chrome Trace Event Format](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/edit)
method supports
supports: (capabilities: { [key: string]: any }) => boolean;
method timeBegin
timeBegin: (name: string) => Promise<any>;
method timeEnd
timeEnd: (name: string, restartName: string) => Promise<any>;
Package Files (22)
- ts/benchpress.ts
- ts/src/common_options.ts
- ts/src/measure_values.ts
- ts/src/metric.ts
- ts/src/metric/multi_metric.ts
- ts/src/metric/perflog_metric.ts
- ts/src/reporter.ts
- ts/src/reporter/console_reporter.ts
- ts/src/reporter/json_file_reporter.ts
- ts/src/reporter/multi_reporter.ts
- ts/src/runner.ts
- ts/src/sample_description.ts
- ts/src/sampler.ts
- ts/src/validator.ts
- ts/src/validator/regression_slope_validator.ts
- ts/src/validator/size_validator.ts
- ts/src/web_driver_adapter.ts
- ts/src/web_driver_extension.ts
- ts/src/webdriver/chrome_driver_extension.ts
- ts/src/webdriver/firefox_driver_extension.ts
- ts/src/webdriver/ios_driver_extension.ts
- ts/src/webdriver/selenium_webdriver_adapter.ts
Dependencies (7)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/benchpress
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/benchpress)
- HTML<a href="https://www.jsdocs.io/package/benchpress"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4571 ms. - Missing or incorrect documentation? Open an issue for this package.