grunt-datadriver is a grunt plugin to run selenium tests with Mocha and WebdriverIO
Getting Started
This plugin requires Grunt ~0.4.0
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-datadriver --save-dev
One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt;
The "datadriver" task
Overview
In your project's Gruntfile, add a section named datadriver
to the data
object passed into grunt.initConfig()
.
Run this task with the grunt datadriver
command.
grunt
Sauce Labs
Example usingTo use a cloud service like Sauce Labs make sure you define host
and port
properties like in the example below as well as authenticate yourself with your username and key.
grunt
Sauce Connect
Example usingIf you specify a tunnel-identifier
within your desiredCapabilities
object, the task
will automatically try to establish a tunnel connection via Sauce Connect. With the tunnel-flags
property you can pass command line options to the created Sauce Tunnel.
grunt
Options
All options get passed into the WebdriverIO remote
function. So this is the place where
you can define your driver instance. You'll find more informations about all WebdriverIO
options here. You can overwrite these
options in any target. Also you have to define all Mocha options here. The following
are supported:
bail
Type: Boolean
Default: false
If true you are only interested in the first execption
ui
Type: String
Default: bdd
Options: bdd | tdd | qunit | exports
Specify the interface to use.
reporter
Type: String
Default: spec
Options: Base | Dot | Doc | TAP | JSON | HTML | List | Min | Spec | Nyan | XUnit | Markdown | Progress | Landing | JSONCov | HTMLCov | JSONStream
Allows you to specify the reporter that will be used.
slow
Type: Number
Default: 75
Specify the "slow" test threshold, defaulting to 75ms. Mocha uses this to highlight test-cases that are taking too long.
timeout
Type: Number
Default: 1000000
Specifies the test-case timeout.
grep
Type: String
When specified will trigger mocha to only run tests matching the given pattern which is internally compiled to a RegExp
.
updateSauceJob
Type: Boolean
Default: false
If true it will automatically update the current job and does publish it.
output
Type: String
Default: null
If set grunt-webdriver will pipe reporter output into given file path
quiet
Type: Boolean
Default: false
If true it prevents the original process.stdout.write from executing - no output at all
nospawn
Type: Boolean
Default: false
If true it will not spawn a new selenium server process (useful if you use Sauce Labs without Sauce Tunnel)
seleniumOptions
Type: Object
Default: {}
Options for starting the Selenium server. For more information check out the selenium-standalone project.
seleniumInstallOptions
Type: Object
Default: {}
Options for installing Selenium dependencies. For more information check out the selenium-standalone project.