Getting Started - Webdriver.io

Follow this guide for a basic example of running a test with Webdriver.io Selenium bindings for Nodejs. For our example we will use a simple script that opens https://www.google.com.

Start by signing up and creating a new test case using the New Test Case button on the dashboard or Test Case -> New... in the left side panel.

Enter the test case name (e.g. Webdriver.io Demo) and press Next.

Scenario

Select Selenium Script as the scenario type.

Scenario

Let's use the following settings:

  1. Bindings: Webdriver.io. Other Selenium Webdriver language bindings will be added to the platform in the future.
  2. Source: Uploaded Files. We can also connect our scenario to version control, but for now let's just upload the files.
  3. Webdriver.io Conf File: wdio.local.js

Settings

The Webdriver.io test runner requires a configuration file and a package.json file that controlls which dependencies are required.

The default configuration file Testable provides uses Mocha as the testing framework and runs the test in Chrome. You are welcome to use other testing frameworks and capabilities as well.

For our test spec we will use the one provided in the wdio-testable-example project.

var assert = require('assert');

describe('A basic test', function() {
  it('should be possible to go to google', function() {
    browser.url('https://www.google.com');
    browser.saveScreenshot((process.env.OUTPUT_DIR || '.') + '/snapshot-' + Date.now() + '.png');
    var title = browser.getTitle();
    assert.equal(title, 'Google');
  });
});

Our basic examples does the following:

  1. Load the Google homepage in Chrome
  2. Save a screenshot to the output directory monitored by Testable
  3. Assert that the title of the page is Google

We upload this test spec to our scenario with the name test.basic.js so that it matches the test.*.js spec pattern defined in our wdio.local.js configuration file.

Files

And that's it, we've now defined our scenario! To try it out before configuring a load test click the Smoke Test button in the upper right and watch Testable execute the scenario 1 time as 1 user.

Click on the Configuration tab or press the Next button at the bottom to move to the next step.

Configuration

Now that we have the scenario for our test case we need to define a few parameters before we can execute our test:

  1. Load Profile: Select Flat to ramp up to a constant number of concurrent users for the test.
  2. Concurrent Clients Per Region: Number of clients that will execute your Webdriver.io script in parallel per region selected. Each concurrent client will run wdio and have a separate Selenium server instance to communicate with.
  3. Test Runners: Choose the test runners that will run this test (e.g. on our public shared grid). Each test runner region will simulate the number of concurrent clients defined above.
  4. Type: Select Iterations to have each concurrent client execute the Webdriver.io script sequentially a set number of times regardless of how long it takes. Choose Duration if you want each client to continue executing the script for a set amount of time (in minutes).

And that's it! Press Start Test and watch the results start to flow in. See the new configuration guide for full details of all configuration options.

For the sake of this example, let's use the following parameters:

Configuration

View Results

Once the test starts executing, Testable will distribute the work out to the selected test runners (e.g. Public Shared Grid in AWS N. Virginia).

Results

In each region, the Testable runners execute the Webdriver.io script with 5 concurrent clients for 1 minute.

Below the resource result grid you can see various graphs. If you click on any resource in the grid, the charts below will update to be specific to that resource only.

Check out the Selenium guide for more details on running your Webdriver.io scripts on the Testable platform.

We also offer integration (Settings -> Integration) with third party tools like New Relic. If you enable integration you can do more in depth analytics on your results there as well.

That's it! Go ahead and try these same steps with your own scripts and feel free to contact us with any questions.