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

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:2101de8a9577
1
2 # Running Tests
3
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.
7
8
9 ## Web
10
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.
14
15 It also creates a function 'testCommands()' to be run at a JS prompt, which
16 enables the test commands for debugging purposes.
17
18
19 ## Firefox
20
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.
23
24 For more information about running Mochitest on Firefox (including GCLI) see
25 [the MDN, Mochitest docs](https://developer.mozilla.org/en/Mochitest)
26
27
28 # Node
29
30 Running the test suite under node can be done as follows:
31
32 $ node gcli.js test
33
34 Or, using the `test` command:
35
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
41
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 ....
47
48 Summary: Pass (951 checks)
49
50
51 # Phantom
52
53 The GCLI test suite can also be run under PhantomJS as follows:
54
55 $ phantomjs ./phantom-test.js
56
57 Summary: Pass (4289 checks)
58
59 Finished running unit tests. (total 3.843s, ave response time 3.36ms, ...)
60
61
62 # Travis CI
63
64 GCLI check-ins are automatically tested by [Travis CI](https://travis-ci.org/joewalker/gcli).
65
66
67 # Test Case Generation
68
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