toolkit/devtools/gcli/source/docs/running-tests.md

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     2 # Running Tests
     4 GCLI has a test suite that can be run in a number of different environments.
     5 Some of the tests don't work in all environments. These should be automatically
     6 skipped when not applicable.
     9 ## Web
    11 Running a limited set of test from the web is the easiest. Simply load
    12 'localtest.html' and the unit tests should be run automatically, with results
    13 displayed on the console. Tests can be re-run using the 'test' command.
    15 It also creates a function 'testCommands()' to be run at a JS prompt, which
    16 enables the test commands for debugging purposes.
    19 ## Firefox
    21 GCLI's test suite integrates with Mochitest and runs automatically on each test
    22 run. Dryice packages the tests to format them for the Firefox build system.
    24 For more information about running Mochitest on Firefox (including GCLI) see
    25 [the MDN, Mochitest docs](https://developer.mozilla.org/en/Mochitest)
    28 # Node
    30 Running the test suite under node can be done as follows:
    32     $ node gcli.js test
    34 Or, using the `test` command:
    36     $ node gcli.js
    37     Serving GCLI to http://localhost:9999/
    38     This is also a limited GCLI prompt.
    39     Type 'help' for a list of commands, CTRL+C twice to exit:
    40     : test
    42     testCli: Pass (funcs=9, checks=208)
    43     testCompletion: Pass (funcs=1, checks=139)
    44     testExec: Pass (funcs=1, checks=133)
    45     testHistory: Pass (funcs=3, checks=13)
    46     ....
    48     Summary: Pass (951 checks)
    51 # Phantom
    53 The GCLI test suite can also be run under PhantomJS as follows:
    55     $ phantomjs ./phantom-test.js
    57     Summary: Pass (4289 checks)
    59     Finished running unit tests. (total 3.843s, ave response time 3.36ms, ...)
    62 # Travis CI
    64 GCLI check-ins are automatically tested by [Travis CI](https://travis-ci.org/joewalker/gcli).
    67 # Test Case Generation
    69 GCLI can generate test cases automagically. Load ```localtest.html```, type a
    70 command to be tested into GCLI, and the press F2. GCLI will output to the
    71 console a template test case for the entered command.

mercurial