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.

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

mercurial