
<h2>getting started</h2>

<p>
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.
</p>

<h2>how yui is using it</h2>

<p>
For months now, `yogi test` has been powering the <a href="http://travis-ci.org/yui/yui3/">YUI/Travis-CI</a> builds,
as of this writing, she has executed an average of `7,200` <a href="http://phantomjs.org/">PhantomJS</a> tests 
(with <a href="http://github.com/davglass/grover">grover</a>)  and `1,200` cli based tests 
(with <a href="http://github.com/yui/yuitest/">YUITest</a> on <a href="http://nodejs.org/">NodeJS</a>) across `450+` builds. 
That's about <strong>3.78 million</strong> tests! And that's just since August of 2012.
</p>

<h2>module testing from the command line or ci</h2>

<p>
With `yogi`, automated/cli YUI testing as never been easier. It's this simple:
</p>

```terminal

$ 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

$ 
```

<p>
This works for any module in the YUI source tree and <a href="../gallery/">properly configured</a> Gallery modules too!
</p>

<h2>code coverage support</h2>

<p>
`yogi` also supports <a href="https://github.com/gotwarlost/istanbul">istanbul</a> code coverage reports too, and they
are just as simple as this:
</p>

```terminal
$ 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

$ 
```

<h2>module testing in the browser</h2>

<p>
`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).
</p>

```terminal
$ 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
```

<p>
Now you can visit `http://127.0.0.1:5000/` to see your <a href="http://github.com/yui/selleck">Selleck</a>
docs, your <a href="https://github.com/yui/yuidoc">YUIDoc</a> powered API docs as well as your tests.
</p>

<h3>also with coverage</h3>

<p>
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!
</p>
