Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

In this tutorial, we will create a test in Javascript+Mocha in order to validate a simple application interaction using Sauce Labs for cloud mobile testing.

...

Info
titlePlease note

Within this tutorial, only one Test Execution will be used; it will contain one Test Run with all the results for the different used browsers. Thus, the overall test run status will be affected by the results made for all the browsers.

Instead of this approach, a different one could be creating a Test Execution per each browser; this would require some adaptions in order to produce a XML report per each used browser. This approach would give the ability to take advantage of Test Environments (more info in Working with Test Environments).


Requirements

  • Install NodeJS
  • Install all dependencies using "npm"

Description

This tutorial is based on Sauce Labs's own tutorial for NodeJS.

...

Code Block
languagejs
titlepackage.json
collapsetrue
{
  "name": "mocha-webdriverio",
  "version": "0.0.1",
  "description": "Parallel tests with Mocha and Webdriverio  =============",
  "main": "",
  "repository": {
    "type": "git",
    "url": "git@github.com:saucelabs-sample-test-frameworks/JS-Mocha-WebdriverIO.git"
  },
  "scripts": {
    "test": "./node_modules/.bin/wdio wdio.conf.js"
  },
  "dependencies": {
    "webdriverio": "*",
    "parallel-mocha": "*",
    "mocha": "*",
    "bitcoder/wdio-junit-reporter": "*",
    "chai": "*",
    "wdio-mocha-framework": "^0.3.10",
    "wdio-sauce-service": "~0.1"
  },
  "devDependencies": {
    "bitcoder/wdio-junit-reporter": "*",
}



Info
titlePlease note

The standard "wdio-junit-reporter" npm package can produce one or more JUnit XML reports. We'll generate the multi report file generation capability.

However, the produced JUnit XML contains testcase elements with a non-suitable classname attribute. Since "wdio-junit-reporter" is unable to customize this attribute, we need to make a change so it generates a proper attribute value. This is the reason we're using a forked version from the upstream project.

...

Test(s) then can be run in parallel using Maven's NPM "test" task.

No Format
npm test

...

In Sauce Labs  you can see some info about it.

References