HTML and CSS Reference
In-Depth Information
"test %F should act as %Y-%m-%d": function () {
assert.areEqual("2009-10-02", this.date.strftime("%F"));
}
});
//create the console
var r = new Y.Console({
newestOnTop : false,
style: 'block'
});
r.render("#testReport");
Y.Test.Runner.add(strftimeTestCase);
Y.Test.Runner.run();
});
When using YUI Test for production code, the required sources should be
downloaded locally. Although the loader is a convenient way to get started, relying
on an internet connection to run tests is bad practice because it means we cannot
run tests while offline.
3.2.1.2 Running Tests
Running tests with YUI Test is as simple as loading up the HTML fixture in a
browser (preferably several browsers) and watching the output in the console, as
seen in Figure 3.1.
3.2.2 Other In-Browser Testing Frameworks
When choosing an in-browser testing framework, options are vast. YUI Test is
among the most popular choices along with JsUnit and QUnit. As mentioned,
JsUnit is long overdue for an upgrade, and I suggest you not start new projects with
it at this point. QUnit is the testing framework developed and used by the jQuery
team. Like YUI Test it is an in-browser test framework, but follows the traditional
xUnit design less rigidly. The Dojo and Prototype.js libraries both have their test
frameworks as well.
One might get the impression that there are almost as many testing frameworks
out there as there are developers unit testing their scripts—there is no defacto
standard way to test JavaScript. In fact, this is true for most programming tasks
that are not directly related to browser scripting, because JavaScript has no general
purpose standard library. CommonJS is an initiative to rectify this situation, orig-
inally motivated to standardize server-side JavaScript. CommonJS also includes a
 
Search WWH ::




Custom Search