Testrunner
WebdriverIO comes with its own test runner to help you start testing as quickly as possible. It is supposed to do all the work for you, allows integrate to 3rd party services, and helps you to run your tests as efficiently as possible.
WebdriverIO's testrunner is bundled separately in the NPM package @wdio/cli
.
Install it like this:
- npm
- Yarn
- pnpm
npm install @wdio/cli
yarn add @wdio/cli
pnpm add @wdio/cli
To see the command line interface help, type the following command in your terminal:
$ npx wdio --help
wdio <command>
Commands:
wdio config Initialize WebdriverIO and setup configuration in
your current project.
wdio install <type> <name> Add a `reporter`, `service`, or `framework` to
your WebdriverIO project
wdio repl <option> [capabilities] Run WebDriver session in command line
wdio run <configPath> Run your WDIO configuration file to initialize
your tests.
Options:
--version Show version number [boolean]
--help Show help [boolean]
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 see what that file should look like.
With the wdio
configuration helper, it is super easy to generate your config file. Just run:
$ npx wdio config
...and it launches the helper utility.
It will ask you questions and generate a config file for you in less than a minute.
Once you have your configuration file set up, you can start your tests by running:
npx wdio run wdio.conf.js
You can also initialize your test run without the run
command:
npx wdio wdio.conf.js