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