SetBatchId method

Class: BatchClose Platform: Appium Language: C# SDK:

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);


Type: string[]

One or more batches to be closed.

Type: IEnumerable<string>

One or more batches to be closed.

Return value

Type: EnabledBatchClose
The returned object is an instance of a class inherited from BatchClose. This is to ensure that you only call BatchClose.Close if you've set the batch ID by calling SetBatchId


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() 
    /* ... other configurations */; 
 * Assign the configuration to all newly created Eyes instances
eyes = new Eyes();
 * 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();