Files
firefox/devtools/shared/gcli/source/docs/running-tests.md
T
Joe Walker 68ab89e5b3 Bug 1253221 - Sync changes from GCLI web project; r=jryans
Changes in this patch:
* GCLI gave up with testing via phantomjs a while ago, but the docs didn't keep
  up, so this fixes the docs.
* gcli/languages/command isn't used in Firefox, but on the web if a converter
  wrongly produces a null DOM node, then the UI just looks blank, so this change
  makes the error more obvious. However we don't use this in Firefox. I'd like to
  remove the module, but not in this patch.
* The delegate type (used when we want to defer the type of a parameter, e.g.
  with "pref set PREFNAME VALUE" where the type of value depends on PREFNAME)
  forced children to be prediction-less. This allows them to decide for themselves
* The file type assumed that the local filesystem was the same as the remote one
  which is clearly wrong. The change to gcli/types/file fixes that.
* Typo fix to gcli/util/util
* On very slow connections gcli/cli.js could get in a pickle where 2 changes
  happened out of order. We've planned for this, but got in wrong, so this just
  adds a bit of defensive programming.

MozReview-Commit-ID: H88W5UDCikM
2016-03-03 12:42:52 +00:00

61 lines
1.7 KiB
Markdown

# 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](https://developer.mozilla.org/en/Mochitest)
# 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)
# Travis CI
GCLI check-ins are automatically tested by [Travis CI](https://travis-ci.org/joewalker/gcli).
# 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.