Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 155 lines (117 sloc) 7.957 kB
dde8fd2 @davglass Added License and README files
authored
1 YUITest Wrapper for PhantomJS
2 =============================
3
2b7d982 @davglass README updates
authored
4 A little command line tool for running [YUITest](http://yuilibrary.com/yuitest) html
dde8fd2 @davglass Added License and README files
authored
5 files inside of PhantomJS.
6
7 This release supports exiting with the proper exit code to fail a build.
8
9 Installation
10 ------------
11
12 You must have the `phantomjs` command line tool installed prior to running this.
13
14 npm -g install grover
15
646f32a @davglass README update
authored
16 This works on Windows too, just make sure your `phantomjs.exe` executable is in your path.
17
89f829e @davglass Adding Travis Build Status to Readme
authored
18 Build Status
19 ------------
20
21 [![Travis Build Status](https://secure.travis-ci.org/davglass/grover.png?branch=master)](http://travis-ci.org/davglass/grover)
22
dde8fd2 @davglass Added License and README files
authored
23 Output
24 ------
25
2b7d982 @davglass README updates
authored
26 grover app/tests/app.html yui/tests/index.html loader/tests/index.html editor/tests/editor.html
27 Starting Grover on 4 files with PhantomJS@1.5.0
28 Running 15 concurrent tests at a time.
29 ✔ [Loader Automated Tests]: Passed: 60 Failed: 0 Total: 60 (ignored 0)
30 ✔ [App Framework]: Passed: 269 Failed: 0 Total: 269 (ignored 0)
31 ✔ [Editor]: Passed: 31 Failed: 0 Total: 31 (ignored 0)
32 ✔ [YUI Core Test Suite]: Passed: 50 Failed: 0 Total: 51 (ignored 1)
33 ----------------------------------------------------------------
34 ✔ [Total]: Passed: 410 Failed: 0 Total: 411 (ignored 1)
35 [Timer] 8.928 seconds
dde8fd2 @davglass Added License and README files
authored
36
37
51603d2 @davglass Readme update
authored
38 Commandline Arguments
39 ---------------------
40
41 grover <paths to yuitest html files>
42 -v, --version Print version
43 -h, --help Print this stuff
44 -s, --silent Print no output, only use exit code
45 -q, --quiet Only print errors and use exit code
46 -f, --fail Fail on first error
2b7d982 @davglass README updates
authored
47 -c, --concurrent Number of tests to run concurrently, default: 15
51603d2 @davglass Readme update
authored
48 -t, --timeout Specify a timeout (in seconds) for a test file to be considered as failed.
49 -i, --import <path to js file> - Require this file and use the exports (array)
50 as the list of files to process.
2b7d982 @davglass README updates
authored
51 -p, --prefix <string> String to prefix to all urls (for dynamic server names)
531eeb7 @davglass Updated README
authored
52 -S, --suffix <string> String to add to the end of all urls (for dynamic server names)
51603d2 @davglass Readme update
authored
53 -o, --outfile <path to export file>
54 You can specify an export type with the following:
55 --tap TAP export (default)
56 --xml XML export
57 --json JSON export
58 --junit JUnit XML export
531eeb7 @davglass Updated README
authored
59 --server Starts a static file server in the CWD, tests should be relative to this directory
60 --port <Number> The port to start the server on
200cc49 @davglass Fixed spelling errors
authored
61 --coverage Generate a coverage report and print it to the screen (you must instrument your own files with YUITest first)
531eeb7 @davglass Updated README
authored
62 --coverage-warn <Number> The percentage to highlight as low coverage, default is 80
51603d2 @davglass Readme update
authored
63
a234cda @davglass Added export options
authored
64 Saving Results
65 --------------
66
67 Grover supports the 4 ways that YUITest exports it's tests results so you can import them
68 into another system.
69
531eeb7 @davglass Updated README
authored
70 grover ./tests/*.html -o ./results/results.json --json
71 grover ./tests/*.html -o ./results/results.xml --xml
72 grover ./tests/*.html -o ./results/results.tap --tap
73 grover ./tests/*.html -o ./results/results.junit.xml --junit
a234cda @davglass Added export options
authored
74
531eeb7 @davglass Updated README
authored
75 Using the built in server
76 -------------------------
a234cda @davglass Added export options
authored
77
531eeb7 @davglass Updated README
authored
78 Using the `--server` command will fire up a server in the `process.cwd()` and serve anything
79 under it as statis content. Then when you select the tests to be run, they are converted to URL's
80 under the hood and fetched from the static server instead of the file system.
81
82 Combine this with `-S` options like this:
83
84 grover --server --port 5000 -S '?filter=coverage' ./tests/foo.html
85
86 This will create a URL like:
87
88 http://127.0.0.1:5000/tests/foo.html?filter=coverage
89
bbef0ad @davglass Added SIGCONT signalling to start the tests after entering --no-run mode
authored
90 You can add `--no-run` to have `grover` fire up the server and prep everything, but not execute the tests.
91 This way you can access the `grover` server from another location (browser). If you want to continue
92 running the tests after launching this way, simply send the process a `SIGCONT` signal (`kill -s SIGCONT [PID]`)
93 and `grover` will start executing the tests like it normally would. This is handy if you have CLI tests that you
94 want to execute against the server before you want the Phantom tests to execute.
95
96
1a56ed9 @davglass Updated README
authored
97 Istanbul Coverage
98 -----------------
99 If you instrument your files with the [Istanbul Coverage Tool](https://github.com/gotwarlost/istanbul), you can
100 have `grover` show you your coverage report:
101
102 grover --coverage --coverage-warn 70 ./tests/*.html
103
104 Will print something like this:
105
106 Starting Grover on 1 files with PhantomJS@1.6.1
107 Running 15 concurrent tests at a time.
108 starting grover server
109 assuming server root as /home/yui/src/yui3
110 ✔ [FOO]: Passed: 8 Failed: 0 Total: 8 (ignored 0) 97%
111 ----------------------------------------------------------------
112 ✔ [Total]: Passed: 8 Failed: 0 Total: 8 (ignored 0)
113 [Timer] 1.114 seconds
114 Generating Coverage Report
115 ┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━┓
116 ┃ path ┃ lines ┃ % ┃ statements ┃ % ┃ functions ┃ % ┃ branches ┃ % ┃
117 ┣━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━╋━━━━━━━━━━╋━━━━━━━━━━━━━━╋━━━━━━━━━━╋━━━━━━━━━━━━━╋━━━━━━━━╋━━━━━━━━━━━━╋━━━━━━━━━━┫
118 ┃ ✖ build/foo/foo.js ┃ 45/46 ┃ 97.83% ┃ 45/46 ┃ 97.83% ┃ 6/6 ┃ 100% ┃ 26/34 ┃ 76.47% ┃
119 ┗━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━┻━━━━━━━━━━┻━━━━━━━━━━━━━━┻━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━┻━━━━━━━━━━━━┻━━━━━━━━━━┛
120
121 **YOU MUST INSTRUMENT YOUR OWN COVERAGE FILES, GROVER JUST GATHERS THE REPORT.**
122
531eeb7 @davglass Updated README
authored
123 YUITest Coverage
124 ----------------
125
126 If you instrument your files with the [YUITest Coverage Tool](http://yuilibrary.com/yuitest/), you can
127 have `grover` show you your coverage report:
128
129 grover --coverage --coverage-warn 70 ./tests/*.html
130
131 Will print something like this:
132
133 Starting Grover on 1 files with PhantomJS@1.6.1
134 Running 15 concurrent tests at a time.
135 starting grover server
136 assuming server root as /home/yui/src/yui3
1a56ed9 @davglass Updated README
authored
137 ✔ [FOO]: Passed: 8 Failed: 0 Total: 8 (ignored 0) 97%
531eeb7 @davglass Updated README
authored
138 ----------------------------------------------------------------
1a56ed9 @davglass Updated README
authored
139 ✔ [Total]: Passed: 8 Failed: 0 Total: 8 (ignored 0)
531eeb7 @davglass Updated README
authored
140 [Timer] 1.114 seconds
141 Generating Coverage Report
bdefeeb @davglass Updated README
authored
142 ┏━━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━┳━━━━━━━━━━━━┳━━━━━━━┓
143 ┃ path ┃ lines ┃ % ┃ functions ┃ % ┃
144 ┣━━━━━━━━━━━━━━━━━━╋━━━━━━━━╋━━━━━━╋━━━━━━━━━━━━╋━━━━━━━┫
145 ┃ ✔ /tests/foo.js ┃ 45/46 ┃ 97% ┃ 6/6 ┃ 100% ┃
146 ┗━━━━━━━━━━━━━━━━━━┻━━━━━━━━┻━━━━━━┻━━━━━━━━━━━━┻━━━━━━━┛
531eeb7 @davglass Updated README
authored
147
bdefeeb @davglass Updated README
authored
148 **YOU MUST INSTRUMENT YOUR OWN COVERAGE FILES, GROVER JUST GATHERS THE REPORT.**
dde8fd2 @davglass Added License and README files
authored
149
150 What's with the name?
151 ---------------------
152
45eabcf @davglass Corrected stupid markdown screwup
authored
153 This tool is dedicated to [Ryan Grove](https://github.com/rgrove) for all his work on YUI over the last year.
dde8fd2 @davglass Added License and README files
authored
154 I told him that my next command line tool would be named "grover" after "rgrove".
Something went wrong with that request. Please try again.