HTML and CSS Reference
In-Depth Information
"test %F should act as %Y-%m-%d": function () {
assertEquals("2009-10-02", this.date.strftime("%F"));
}
});
The test methods are almost syntactically identical to the YUI Test example,
but note how this test case has less scaffolding code to support the test runner. Now
create the configuration file as shown in Listing 3.9.
Listing 3.9 JsTestDriver configuration
server: http://localhost:4224
load:
- src/*.js
- test/*.js
We can now schedule tests to run by issuing the command in Listing 3.10 or
Listing 3.11, depending on your operating system.
Listing 3.10 Running tests with JsTestDriver on Linux and OSX
java -jar $JSTESTDRIVER_HOME/JsTestDriver-1.2.1.jar --tests
all
Listing 3.11 Running tests with JsTestDriver on Windows
java -jar %JSTESTDRIVER_HOME%\JsTestDriver-1.2.1.jar--tests
all
The default configuration file name is jsTestDriver.conf , and as long
as this is used we don't need to specify it. When using another name, add the
--config path/to/file.conf option.
When running tests, JsTestDriver forces the browser to refresh the test files.
Source files, however, aren't reloaded between test runs, which may cause errors due
to stale files. We can tell JsTestDriver to reload everything by adding the --reset
option.
3.4.3.6 JsTestDriver and TDD
When TDD-ing, tests will fail frequently, and it is vital that we are able to quickly
verify that we get the failures we expect in order to avoid buggy tests. A browser such
as Internet Explorer is not suitable for this process for a few reasons. First, its error
 
Search WWH ::




Custom Search