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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/devtools/gcli/source/docs/running-tests.md	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,71 @@
     1.4 +
     1.5 +# Running Tests
     1.6 +
     1.7 +GCLI has a test suite that can be run in a number of different environments.
     1.8 +Some of the tests don't work in all environments. These should be automatically
     1.9 +skipped when not applicable.
    1.10 +
    1.11 +
    1.12 +## Web
    1.13 +
    1.14 +Running a limited set of test from the web is the easiest. Simply load
    1.15 +'localtest.html' and the unit tests should be run automatically, with results
    1.16 +displayed on the console. Tests can be re-run using the 'test' command.
    1.17 +
    1.18 +It also creates a function 'testCommands()' to be run at a JS prompt, which
    1.19 +enables the test commands for debugging purposes.
    1.20 +
    1.21 +
    1.22 +## Firefox
    1.23 +
    1.24 +GCLI's test suite integrates with Mochitest and runs automatically on each test
    1.25 +run. Dryice packages the tests to format them for the Firefox build system.
    1.26 +
    1.27 +For more information about running Mochitest on Firefox (including GCLI) see
    1.28 +[the MDN, Mochitest docs](https://developer.mozilla.org/en/Mochitest)
    1.29 +
    1.30 +
    1.31 +# Node
    1.32 +
    1.33 +Running the test suite under node can be done as follows:
    1.34 +
    1.35 +    $ node gcli.js test
    1.36 +
    1.37 +Or, using the `test` command:
    1.38 +
    1.39 +    $ node gcli.js
    1.40 +    Serving GCLI to http://localhost:9999/
    1.41 +    This is also a limited GCLI prompt.
    1.42 +    Type 'help' for a list of commands, CTRL+C twice to exit:
    1.43 +    : test
    1.44 +    
    1.45 +    testCli: Pass (funcs=9, checks=208)
    1.46 +    testCompletion: Pass (funcs=1, checks=139)
    1.47 +    testExec: Pass (funcs=1, checks=133)
    1.48 +    testHistory: Pass (funcs=3, checks=13)
    1.49 +    ....
    1.50 +    
    1.51 +    Summary: Pass (951 checks)
    1.52 +
    1.53 +
    1.54 +# Phantom
    1.55 +
    1.56 +The GCLI test suite can also be run under PhantomJS as follows:
    1.57 +
    1.58 +    $ phantomjs ./phantom-test.js
    1.59 +    
    1.60 +    Summary: Pass (4289 checks)
    1.61 +    
    1.62 +    Finished running unit tests. (total 3.843s, ave response time 3.36ms, ...)
    1.63 +
    1.64 +
    1.65 +# Travis CI
    1.66 +
    1.67 +GCLI check-ins are automatically tested by [Travis CI](https://travis-ci.org/joewalker/gcli).
    1.68 +
    1.69 +
    1.70 +# Test Case Generation
    1.71 +
    1.72 +GCLI can generate test cases automagically. Load ```localtest.html```, type a
    1.73 +command to be tested into GCLI, and the press F2. GCLI will output to the
    1.74 +console a template test case for the entered command.

mercurial