Skip to main content

BatchInfo class

Call the Configuration.setBatch method or Eyes.setBatch method with an object of this class to configure the batch for one or more tests.

See How to group tests into batches using the SDK for details and an example.

Require statement

const {BatchInfo} = require('@applitools/eyes-images');

BatchInfo method

Syntax

//overloaded methods
let batchinfo = new BatchInfo();
let batchinfo = new BatchInfo(batch);
let batchinfo = new BatchInfo(name);
let batchinfo = new BatchInfo(name, startedat);
let batchinfo = new BatchInfo(name, startedat, id);

Parameters

name

Type: string

The name of the batch. If a null is passed then the name will be taken from the environment variable APPLITOOLS_BATCH_NAME. If the environment variable is not defined then the name of the first test is used as the batch name.

startedAt

Type:

Date|string\[Optional \]

The date and time that will be displayed in the Test Manager as the batch start time.

id

Type: string [Optional ]

The unique id of the batch. If not passed, or passed as null, and the environment variable APPLITOOLS_BATCH_ID is defined, then the value of the environment variable will be used as the id. If the environment variable is not defined then a unique internal id will be generated and used.

Return value

Type: BatchInfo

getId method

Syntax

let value = batchInfo.getId();

Parameters

This method does not take any parameters.

Return value

Type: string

getName method

Syntax

let value = batchInfo.getName();

Parameters

This method does not take any parameters.

Return value

Type: string

getNotifyOnCompletion method

Syntax

let value = batchInfo.getNotifyOnCompletion();

Parameters

This method does not take any parameters.

Return value

Type: boolean

getSequenceName method

Syntax

let value = batchInfo.getSequenceName();

Parameters

This method does not take any parameters.

Return value

Type: string

getStartedAt method

Syntax

let value = batchInfo.getStartedAt();

Parameters

This method does not take any parameters.

Return value

Type: Date

setId method

Syntax

let value = batchInfo.setId(value);

Parameters

value

Type: string

The unique id of the batch. If not passed, or passed as null, and the environment variable APPLITOOLS_BATCH_ID is defined, then the value of the environment variable will be used as the id. If the environment variable is not defined then a unique internal id will be generated and used.

Return value

Type: BatchInfo

Remarks

If the id is not set, and the environment variable APPLITOOLS_BATCH_ID is defined, then its value will be used as the id. If the environment variable is not defined, then an internal unique id will be generated and used. Since this value is unique for each test run, if you don't set the id explicitly you can only batch tests that run in the current test run.

setName method

Syntax

let value = batchInfo.setName(name);

Parameters

name

Type: string

The name of the batch.

Return value

Type: BatchInfo

setNotifyOnCompletion method

Syntax

let value = batchInfo.setNotifyOnCompletion(notifyOnCompletion);

Parameters

notifyOnCompletion

Type: boolean

If this value is true then a notification will be sent.

Return value

Type: BatchInfo

setSequenceName method

Syntax

//typical code sequence using setSequenceName
let batchInfo = new BatchInfo("my batch name");
let sequenceName = "My sequence name";
batchInfo.setSequenceName(sequenceName);
eyes.setBatch(batchInfo);

Parameters

sequenceName

Type: string

The name to be assigned to the batch sequence

Return value

Type: BatchInfo

Remarks

If you do not set this attribute and the environment variable APPLITOOLS_BATCH_SEQUENCE is defined, then the value of the environment variable will be used as the sequence name. If the environment variable is not defined, then the batch will not be associated with any sequence name.

setStartedAt method

Syntax

let value = batchInfo.setStartedAt(startedAt);

Parameters

startedAt

Type: string

The date and time that will be displayed in the Test Manager as the batch start time.

Return value

Type: BatchInfo