Add visualValidation to capabilities

Learn how to add visualValidation to your capabilities so you can test your UI output and ensure it displays correctly across all devices, operating systems, and form factors.

Locate config file

First, open your test suite and locate your config file. The exact name and location may vary, but you’ll find it in a similar location:

└── src
    └── test
        └── Config # Java TestNG
        └── # Java JUnit
        └── config.js # NodeJS Mocha

Add capability

In the config file, locate DesiredCapabilities, and add the following lines:

Capability Value






Select a baseline session to use by assigning its session ID.

public static DesiredCapabilities getIPhone11ProIOS146DesiredCapabilities() {
        DesiredCapabilities capabilities = new DesiredCapabilities();

        // Change these capabilities:

        capabilities.setCapability("kobiton:visualValidation", true); // Set to true.
        capabilities.setCapability("ensureWebviewsHavePages", true); // Set to true.
        capabilities.setCapability("kobiton:baselineSessionId", 0000011); // Select a baseline session by assigning its session ID.

    return capabilities;

When you’re finished, save your changes. Now you can use visualValidation to test a single device. To test devices in parallel, also modify your setup() function.

Run in parallel

To run visual testing on devices in parallel you’ll need to modify the setup() function in your test directory. The exact location of the function depends on the framework you selected.

Here’s where you may find setup():

└── src
    └── test
        └── // Java testing framework
        └── // Java testing framework

Once you locate the setup() function, assign the amount devices you want to use in parallel as an integer in the second parameter.

testApp.setup(capabilities, <device-count>); // Assign how many devices you want to run in parallel to <device-count>.
// Located in test/scriptlessautomation/TestSuite in the Java's TestNG framework.

public class TestSuite {
    public void testOnIPhone11ProIOS146() throws Exception {
        TestApp testApp = new TestApp();
        DesiredCapabilities capabilities = Config.getIPhone11ProIOS146DesiredCapabilities();
        testApp.setup(capabilities, 3); // Run this test on 3 similar devices in parallel.

Now you can use visualValidation to test a multiple devices running in parallel.