The next article will explain how to create a batch which includes several tests.
For your convenience please find the following video guide below:
setBatch is a helpful Applitools Eyes command, that provides us the ability to gather multiple tests and run them together.
After setting your API key, you can go ahead and add the next commands:
eyes.setBatch (new batchInfo("login")
After creating a new batch info command, you can go ahead and specify the string with the name of the batch (e.g "login").
Note that by using this method the results of your tests will be displayed as two separate batches:
The reason the tests appear separated has to do with the method written before each test:
In order to cluster the tests together, we need to change a few commands in our test code:
First, we need to create a batch info object before each of the tests, and reference the object to each of our tests.
To do that, we need to create a BeforeClass method, that will run before the TestClass, and set it as a static method called setBatch.
Next, instead of just naming the string, as we did before, we need to store it in a batch field variable, which we need to create following this step:
Next, we can go down to the previous setBatch command and create a few little changes:
Before the last change: After the last change:
After making those changes and running the test, we will see the next results in our test results:
As you can see, instead of having two separate test results as before, the tests are now batched together under the same result.
In unique cases, where you need to aggregate tests from different instances, processes or machines (with potentially different batchInfo objects) Applitools Batch ID command can be used.
The batch ID is one of the batch's optional parameters (other than batch name for example). Setting the same Batch ID to each of the relevant tests which you wish to aggregate together will group them under the same batch.
Note: Make sure to generate a unique batch ID for each of your batches, which will prevent irrelevant tests to be grouped under the same batch.
BatchInfo b = new BatchInfo("BATCH_NAME_HERE");
from applitools.eyes import BatchInfo
b = BatchInfo("BATCH_NAME_HERE")