HTML and CSS Reference
to keep things simple—complicated test runners greatly decreases the likelihood of
developers running tests.
3.2.1 YUI Test
framework. YUI from Yahoo! is no exception. YUI Test 3 can be safely used to
in its own words, “not a direct port from any specific xUnit framework,” but it
“does derive some characteristics from nUnit and JUnit,” with nUnit being the
.NET interpretation of the xUnit family of frameworks, written in C#. YUI Test is a
mature testing framework with a rich feature set. It supports a rich set of assertions,
test suites, a mocking library (as of YUI 3), and asynchronous tests.
Setup is very easy thanks to YUI's loader utility. To get quickly started, we can link
directly to the YUI seed file on the YUI server, and use YUI.use to fetch the
necessary dependencies. We will revisit the strftime example from Chapter 1,
Automated Testing , in order to compare YUI Test to the testCase function in-
troduced in that chapter. Listing 3.1 shows the HTML fixture file, which can be
saved in, e.g., strftime _ yui _ test.html .
Listing 3.1 YUI Test HTML fixture file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
<title>Testing Date.prototype.strftime with YUI</title>
<div id="yui-main"><div id="testReport"></div></div>