Menu

Build Status

Intro

Intro

Functional unit tests located in test/unit are run in node using Mocha, Chai and Sinon. They are preferred way to test the behaviour of isolated pieces of code or when behaviour depends on the browser version.

Karma is used to run the end-to-end tests which are also based on Mocha, Chai and Sinon. Those tests are run in many browsers using the different karma launchers for Chrome, Firefox, MicrosoftEdge and Safari. Not all expected tests are expected to pass and they will be compared again expectation files similar to Chrome tests. This provides ensures stability while not restricting the project to tests that pass in all browsers.

Development

Detailed information on developing in the webrtc GitHub repo can be mark in the WebRTC GitHub repo developer’s guide.

This guide assumes you are running a Debian based Linux distribution (travis-multirunner currently fetches .deb browser packages).

Clone the repo in desired folder

git clone https://github.com/webrtc/adapter.git

Install npm dependencies

npm install

Build

In order to get a usable file, you need to build it.

grunt build

This will result in 4 files in the out/ folder:

Run tests

Runs grunt and tests in test/tests.js. Change the browser to your choice, more details here

BROWSER=chrome BVER=stable npm test

Add tests

When adding tests make sure to update the test expectation file for all browsers and supported version. The easiest way to do so is to set the CI and UPDATE_STABILITYREPORTER environment variables and re-run the tests with all browsers.

Once your test is ready, create a pull request and see how it runs on travis-multirunner. Usually the expectation is for a test to pass in at least one browser. File browser bugs for tests that do not meet this expectation!

Change browser and channel/version for testing

Chrome stable is currently installed as the default browser for the tests.

Currently Chrome and Firefox are supported*, check travis-multirunner repo for updates around this. Firefox channels supported are stable, beta, nightly and ESR. Chrome channels supported on Linux are stable, beta and unstable. Microsoft Edge is supported on Windows and Safari on OSX.

To select a different browser and/or channel version, change environment variables BROWSER and BVER, then you can rerun the tests with the new browser.

export BROWSER=firefox BVER=nightly

Alternatively you can also do it without changing environment variables.

BROWSER=firefox BVER=nightly npm test

Getting crash dumps from karma

Sometimes Chrome may crash when running the tests. This typically shows up in headless runs as a disconnect:

05 01 2018 10:42:14.225:WARN [HeadlessChrome 0.0.0 (Linux 0.0.0)]: Disconnected (1 times)

Follow these steps to get a crash dump: