Skip to main content

ClassicRunner class

An object of this class is used to manage multiple Eyes sessions when working without the Ultrafast Grid.

To work with the Ultrafast Grid, use VisualGridRunner instead of this class.

Import statement

import com.applitools.eyes.selenium.ClassicRunner;

ClassicRunner method

Syntax

ClassicRunner runner = new ClassicRunner();

Parameters

This method does not take any parameters.

Return value

Type: ClassicRunner

getAllTestResults method

Syntax

TestResultsSummary runner = runner.getAllTestResults();

TestResultsSummary runner = runner.getAllTestResults(shouldThrowException);

Parameters

shouldThrowException

Type: boolean

If a value of true is passed and any test did not pass, or there was a failure, then an exception is thrown. If a value of false is passed, then the object returned contains the test results and status of all the tests. The calling program should use the TestResultContainer.getException method to examine the exception status and, if it is null, check the various methods in the TestResults returned by the method getTestResults to see if the tests passed or mismatched where found. If no parameter is passed, then the default value is true.

Return value

Type: TestResultsSummary

setDontCloseBatches method

Introduction

Syntax

runner.setDontCloseBatches(dontCloseBatches);

Parameters

dontCloseBatches

Type: boolean

Pass a value of true to disable Auto batch closure.

Return value

Type: void

Example

The example below:

Note that the batch ID of the batch being closed needs to be passed to the BatchClose.setBatchId method. In this example, we assume that a batch ID was set for all of the batches by assigning a unique ID to the APPLITOOLS_BATCH_ID environment variable. This is used as a default by the Configuration.setBatch method which is set up in the suite Configuration object and then assigned to each Eyes instance.

Java

/*
* After creating the runner, configure it so that won't close the batch
*/
runner = new VisualGridRunner(new RunnerOptions().testConcurrency(concurrentSessions));
runner.setDontCloseBatches(true);
/*
* Setup a common batch for all tests
*/
BatchInfo batchInfo = new BatchInfo(batchName);
batchInfo.setId(myGetUniqueBatchID()); // User defined
suiteConfig = new Configuration()
.setBatch(batchInfo)
/* ... other configurations */;
/*
* Assign the configuration to all newly created Eyes instances
*/
eyes = new Eyes(runner);
eyes.setConfiguration(suiteConfig);
/*
* After all the tests have completed, in all the runners
*/
List<String> batchIds = Arrays.asList(System.getenv("APPLITOOLS_BATCH_ID"));
BatchClose batchClose = new BatchClose();
batchClose.setBatchId(batchIds).close();