How to run multiple tests at once in webdriver io a simple guide

Mar 7, 2024 | by Ralph Van Der Horst

How to Run Multiple Tests at Once in WebdriverIO A Simple Guide

How to Run Multiple Tests at Once in WebdriverIO: A Simple Guide

Are you looking to speed up your testing process with WebdriverIO? Running tests in parallel across different web browsers is a fantastic way to do this. Here’s a straightforward guide to get you started, even if you’re new to automated testing.

Setting Up Your Environment

First things first: to run tests in parallel, you need to set up your environment correctly. The good news is, this is pretty easy to do during your initial setup or installation of WebdriverIO. Let’s say you want to run tests in both Chrome and Microsoft Edge. Simply enable these browsers at the beginning, and they will be automatically added to an array in a file named wdio.conf. This array is known as the capabilities array. (I’ve selected Chrome and Microsoft Edge in my initial setup)

setup webdriverio learn automated testing

But what if you decide later on that you want to add more browsers? No problem! You can manually add additional browsers by following these steps:

  1. Install the browser driver
  • Chrome
  • Edge
  • Firefox
  • Safari
  1. Install the WebdriverIO driver services for the new browser
  • Chrome
  • Edge
  • Firefox
  • Safari
  1. Manually add the new browser to both the services array and the capabilities array in the wdio.conf file.

Capabilities array

capabilities webdriverio learn automated testing

Services array

services array learn automated testing

Initially, when you install browsers during the setup, you’ll notice the services array is empty and commented out. This is normal, so don’t worry.

Running Your Tests

Now that your setup is complete, you might be wondering how to run your tests in these browsers. If you want to run a test in just one browser, it’s as simple as commenting out the other browsers in the capabilities array. This tells WebdriverIO to ignore those browsers for the current test run.

capabilities array learn automated test

Why Run Tests in Parallel?

Running tests in parallel can significantly speed up your testing process. Instead of running tests one after another in a single browser, you can run them at the same time in different browsers. This not only saves time but also ensures your application works across multiple browser environments.

Getting Started

To get started, make sure you’ve got WebdriverIO installed and set up with at least one browser enabled. From there, you can easily add more browsers and run your tests in parallel. This approach is efficient and helps you catch and fix compatibility issues faster. Play around with the maxInstances property, by default it is set to 10.

Or add a maxInstances property to the browser object, this will override the general maxInstances property.

max instances learn automated testing

That’s it! You’re now ready to run your tests in parallel using WebdriverIO. Remember, the key to efficient testing is not just running tests faster but also ensuring your application performs well across different browsers and environments.

by Ralph Van Der Horst

arrow right
back to blog

share this article

Relevant articles

Mastering Waits in UI Automation

Feb 25, 2024

Mastering Waits in UI Automation

How to serve an Allure Report on GitHub Pages A Step by Step Guide

Mar 7, 2024

How to serve an Allure Report on GitHub Pages A Step by Step Guide

Performance Testing at scale via wdio a practical case

Feb 26, 2024

Performance Testing at scale via wdio a practical case