Mocha Executor

Allows running javascript tests based on Mocha.

Taurus can loop test suite execution in a loop until desired number of iterations will complete or hold-for time will be exceeded.

Taurus currently uses Mocha v4 as default version. ##Usage

- executor: mocha
    script: tests/  # folder with your tests or path to one test script

Basic example of Mocha test with Selenium webdriver:

const assert = require('assert'),
    webdriver = require('selenium-webdriver');
let driver;
describe('Blazedemo verification', function() {
    before(async () => {
        driver = new webdriver.Builder().
        await driver.get('');
    after(function () {
  • *Note**: When using Selenium Webdriver api, be aware that it uses async behavior with its commands. For example, command driver.get will return a promise, which will be resolved only when webdriver fully loads page.

Supported file types:

Test scenario may be presented as single javascript file or as a folder.

You can also find an example of complete Mocha-based test suite and Taurus config to run it with in examples/selenium/mocha folder of Taurus's repo.


By default, Taurus will install Mocha and its dependencies with npm into ~/.bzt/selenium-taurus/mocha/ directory. You can customize it with tools-dir module setting.

    tools-dir: my-dir