HTML and CSS Reference
In-Depth Information
frameworks are easier to work with, but fail at testing in the actual environment the
code will be running in, reducing their usefulness as testing tools. A fairly new player
on the field of xUnit testing frameworks is JsTestDriver, originating from Google.
In contrast to the traditional frameworks, JsTestDriver is first and foremost a test
runner, and a clever one at that. JsTestDriver solves the aforementioned problems
by making it easy both to run tests and to test widely in real browsers.
3.4.1 How JsTestDriver Works
JsTestDriver uses a small server to run tests. Browsers are captured by the test
runner and tests are scheduled by issuing a request to the server. As each browser
runs the tests, results are sent back to the client and presented to the developer. This
means that as browsers are idly awaiting tests, we can schedule runs from either the
command line, the IDE, or wherever we may feel most comfortable running them
from. This approach has numerous advantages:
Tests can be run in browsers without requiring manual interaction with the
browser.
Tests can be run in browsers on multiple machines, including mobile devices,
allowing for arbitrary complex testing grids.
Tests run fast , due to the fact that results need not be added to the DOM and
rendered, they can be run in any number of browsers simultaneously, and the
browser doesn't need to reload scripts that haven't changed since the tests
were last run.
Tests can use the full DOM because no portion of the document is reserved
for the test runner to display results.
No need for an HTML fixture, simply provide one or more scripts and test
scripts, an empty document is created on the fly by the test runner.
JsTestDriver tests are fast . The test runner can run complex test suites of several
hundred tests in under a single second. Because tests are run simultaneously, tests will
still run in about a second even when testing 15 browsers at the same time. Granted,
some time is spent communicating with the server and optionally refreshing the
browser cache, but a full run still completes in a matter of a few seconds. Single test
case runs usually complete in the blink of an eye.
As if faster tests, simpler setup, and full DOM flexibility weren't enough, JsTest-
Driver also offers a plugin that calculates test coverage, XML test report output com-
patible with JUnit's reports, meaning we can immediately use existing continuous
 
Search WWH ::




Custom Search