Set the batch ID of the batches that should be closed.
When closing a batch manually, this call is typically followed by a call to the method BatchClose.Close.
EnabledBatchClose value = obj.SetBatchId(batchIds);
One or more batches to be closed.
One or more batches to be closed.
The example below illustrates how to close a batch programmatically:
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 environment variable APPLITOOLS_BATCH_ID. This is used as a default by the method Configuration.SetBatch which is set up in a suite Configuration object and assigned to each Eyes instance.
/*
* Setup a common batch for all tests
*/
BatchInfo batchInfo = new BatchInfo(batchName);
batchInfo.Id = MyGetUniqueBatchID(); // User defined
suiteConfig = (Configuration) new Configuration()
.SetBatch(batchInfo)
/* ... other configurations */;
/*
* Assign the configuration to all newly created Eyes instances
*/
eyes = new Eyes();
eyes.SetConfiguration(suiteConfig);
/*
* After all the tests have completed, in all the runners
*/
List<String> batchIds = new List<string>() { Environment.GetEnvironmentVariable("APPLITOOLS_BATCH_ID") };
BatchClose batchClose = new BatchClose();
batchClose.SetBatchId(batchIds).Close();