getting started
Testing with yogi
will change your life, I'm not kidding! yogi
makes it so simple and fast to
test your module code that you will wonder where she has been all your life.
how yui is using it
For months now, yogi test
has been powering the YUI/Travis-CI builds,
as of this writing, she has executed an average of 7,200
PhantomJS tests
(with grover) and 1,200
cli based tests
(with YUITest on NodeJS) across 450+
builds.
That's about 3.78 million tests! And that's just since August of 2012.
module testing from the command line or ci
With yogi
, automated/cli YUI testing as never been easier. It's this simple:
$ cd yui3/src/json; $ yogi test yogi [info] using yogi@0.0.35 on node@0.8.14 yogi [info] using module: json yogi [info] prepping grover tests yogi [info] adding tests route yogi [info] listening on: http://127.0.0.1:5000 yogi [info] starting cli tests for: json YUITest@0.7.8 ...................................................................... Total tests: 70, Failures: 0, Skipped: 0, Time: 0.073 seconds yogi [info] yuitest tests complete Starting Grover on 1 files with PhantomJS@1.7.0 Running 15 concurrent tests at a time. ✔ [JSON]: Passed: 69 Failed: 0 Total: 69 (ignored 0) (0.823 seconds) ---------------------------------------------------------------- ✔ [Total]: Passed: 69 Failed: 0 Total: 69 (ignored 0) (0.823 seconds) [Grover Execution Timer] 1.378 seconds yogi [info] grover tests complete $
This works for any module in the YUI source tree and properly configured Gallery modules too!
code coverage support
yogi
also supports istanbul code coverage reports too, and they
are just as simple as this:
$ cd yui3/src/json; $ yogi test --coverage --istanbul yogi [info] using yogi@0.0.35 on node@0.8.14 yogi [info] using module: json yogi [info] prepping grover tests yogi [info] adding tests route yogi [info] listening on: http://127.0.0.1:5000 yogi [info] starting cli tests for: json YUITest@0.7.8 ...................................................................... Total tests: 70, Failures: 0, Skipped: 0, Time: 0.079 seconds yogi [info] yuitest tests complete yogi [info] turning on coverage support in grover Starting Grover on 1 files with PhantomJS@1.7.0 Running 15 concurrent tests at a time. ✔ [JSON]: Passed: 69 Failed: 0 Total: 69 (ignored 0) (0.829 seconds) 89% ------------------------+-----------+-----------+-----------+-----------+ File | % Stmts |% Branches | % Funcs | % Lines | ------------------------+-----------+-----------+-----------+-----------+ json-parse/ | 93.75 | 78.13 | 87.5 | 93.75 | json-parse.js | 93.75 | 78.13 | 87.5 | 93.75 | json-stringify/ | 84.52 | 82.56 | 72.73 | 84.52 | json-stringify.js | 84.52 | 82.56 | 72.73 | 84.52 | ------------------------+-----------+-----------+-----------+-----------+ All files | 87.07 | 81.36 | 78.95 | 87.07 | ------------------------+-----------+-----------+-----------+-----------+ =============================== Coverage summary =============================== Statements : 87.07% ( 101/116 ) Branches : 81.36% ( 96/118 ) Functions : 78.95% ( 15/19 ) Lines : 87.07% ( 101/116 ) ================================================================================ ---------------------------------------------------------------- ✔ [Total]: Passed: 69 Failed: 0 Total: 69 (ignored 0) (0.829 seconds) [Grover Execution Timer] 1.494 seconds yogi [info] grover tests complete $
module testing in the browser
yogi
comes with a very helpful server feature as well. You can execute: yogi serve
and she will show you your tests (docs and api docs too).
$ cd yui3/src/json; $ yogi serve --istanbul yogi [info] using yogi@0.0.35 on node@0.8.14 yogi [info] using module: json yogi [info] adding tests route yogi [info] this is yui, using global path for all docs yogi [info] launching yuidoc --server 5001 --config /ssd/home/yui/src/yui3/src/common/api/yuidoc.json yogi [info] this is yui, using global path for all docs yogi [info] launching selleck --server 5002 --project /ssd/home/yui/src/yui3/src/common/docs/ yogi [info] listening on: http://127.0.0.1:5000
Now you can visit http://127.0.0.1:5000/
to see your Selleck
docs, your YUIDoc powered API docs as well as your tests.
also with coverage
When launching yogi serve
, she will find all your module tests and show them to you. If you access the coverage
versions of your tests, they will run and then show you the coverage report so you can see what you missed!