Files
tubestation/devtools/shared/gcli/source/docs/running-tests.md
J. Ryan Stinnett a3073e0420 Bug 912121 - Migrate major DevTools directories. rs=devtools
Move major DevTools files to new directories using the following steps:

hg mv browser/devtools devtools/client
hg mv toolkit/devtools/server devtools/server
hg mv toolkit/devtools devtools/shared

No other changes are made.
2015-09-21 12:02:24 -05:00

1.9 KiB

Running Tests

GCLI has a test suite that can be run in a number of different environments. Some of the tests don't work in all environments. These should be automatically skipped when not applicable.

Web

Running a limited set of test from the web is the easiest. Simply load 'localtest.html' and the unit tests should be run automatically, with results displayed on the console. Tests can be re-run using the 'test' command.

It also creates a function 'testCommands()' to be run at a JS prompt, which enables the test commands for debugging purposes.

Firefox

GCLI's test suite integrates with Mochitest and runs automatically on each test run. Dryice packages the tests to format them for the Firefox build system.

For more information about running Mochitest on Firefox (including GCLI) see the MDN, Mochitest docs

Node

Running the test suite under node can be done as follows:

$ node gcli.js test

Or, using the test command:

$ node gcli.js
Serving GCLI to http://localhost:9999/
This is also a limited GCLI prompt.
Type 'help' for a list of commands, CTRL+C twice to exit:
: test

testCli: Pass (funcs=9, checks=208)
testCompletion: Pass (funcs=1, checks=139)
testExec: Pass (funcs=1, checks=133)
testHistory: Pass (funcs=3, checks=13)
....

Summary: Pass (951 checks)

Phantom

The GCLI test suite can also be run under PhantomJS as follows:

$ phantomjs ./phantom-test.js

Summary: Pass (4289 checks)

Finished running unit tests. (total 3.843s, ave response time 3.36ms, ...)

Travis CI

GCLI check-ins are automatically tested by Travis CI.

Test Case Generation

GCLI can generate test cases automagically. Load localtest.html, type a command to be tested into GCLI, and the press F2. GCLI will output to the console a template test case for the entered command.