QUnit is a powerful, easy-to-use JavaScript unit testing framework. It's used by the jQuery, jQuery UI and jQuery Mobile projects and is capable of testing any generic JavaScript code, including itself!
You can use jQuery's load() function to load the HTML page you want to test. In your JSTestDriver test function:
$('html').load('pageToLoad.html', function() {
// load was performed - run your asserts here now
});
However, since this uses a callback function, you might have to use an Async Test Case.
It's more typical to keep older versions of your document inside your current revision (either as JSON or, often, as an attachment). For the JSON case;
{
"_id":"foo",
"_rev":"3-fsfsfsdf",
"foo":"current value of foo",
"history": {
"2": {
"foo":"previous version of foo"
},
"1": {
"foo":"initial version of foo"
}
}
}
t's often simpler to push the full old version of the document into an attachment instead. This pattern is common enough that CouchDB ships with a library, jquery.couch.js, that implements it (in the saveDoc(doc) function).
PhantomJS is a headless WebKit scriptable with a JavaScript API.
It has fast and native support for various web standards:
DOM handling, CSS selector, JSON, Canvas, and SVG.
Page Automation
Access and manipulate webpages
with the standard DOM API, or with
usual libraries like jQuery.
Learn more
Headless Website Testing
Run functional tests with frameworks such as Jasmine, QUnit, Mocha, Capybara, WebDriver, and many others.
Learn more