Getting Started
WebdriverIO comes with its own test runner to help you get started with integration testing as quickly as possible. All the fiddling around hooking up WebdriverIO with a test framework belongs to the past. The WebdriverIO runner does all the work for you and helps you to run your tests as efficiently as possible.
To see the command line interface help just type the following command in your terminal:
1 | $ ./node_modules/.bin/wdio --help |
Sweet! Now you need to define a configuration file where all information about your tests, capabilities and settings are set. Switch over to the Configuration File section to find out how that file should look like. With the wdio
configuration helper it is super easy to generate your config file. Just run:
1 | $ ./node_modules/.bin/wdio config |
and it launches the helper utility. It will ask you questions depending on the answers you give. This way you can generate your config file in less than a minute.

Once you have your configuration file set up you can start your integration tests by calling:
1 | $ ./node_modules/.bin/wdio wdio.conf.js |
That’s it! Now, you can access to the selenium instance via the global variable browser
.
Run the test runner programmatically
Instead of calling the wdio command you can also include the test runner as module and run in within any arbitrary environment. For that you need to require the launcher module (in /node_modules/webdriverio/build/launcher
) the following way:
1 | var Launcher = require('webdriverio').Launcher; |
After that you create an instance of the launcher and run the test. The Launcher class expects as parameter the url to the config file and accepts certain parameters that will overwrite the value in the config.
1 | var wdio = new Launcher(opts.configFile, opts); |
The run command returns a Promise that gets resolved if the test ran successful or failed or gets rejected if the launcher was not able to start run the tests.