CouchDB is a database that I quite like. In fact, I haven't done much else this winter, as the programming part of my thesis involved diving into many of CouchDB's features. I had just finished my little program and was desperately looking for an excuse not to start writing the thesis. Mercifully Jan from Couchio came along and asked if I wouldn't like to write a testsuite for CouchDB's Javascript HTTP API, and the documentation with it. I wanted!
What is this HTTP API?
If you have worked with CouchDB from a Javascript program before (eg Sammy.js is a good companion for a simple web application), you have probably used the methods a file named couch.js provides. With this interface you can easily access the most common CouchDB functionality without having to handle the XMLHttpRequest yourself. It allows you to create a "database object" and then perform things on this object, for example save or delete documents:
Last thursday I gave a talk at the monthly meeting of the Berlin JS Usergroup. I was talking about JSpec, a Javascript Unit Testing framework. Thanks to all who were there to listen and ask questions!
Here are the slides. When you have a look at them, make sure to also read the notes (next to the comments), so the slides make sense to you.
To find more information about JSpec, check out the README on github, or read the blog post I wrote about it recently.
Selecting a unit test framework for a JavaScript-only application - not a task with an obvious answer! Coming from the Rails world, where most people work with either TestUnit or RSpec, I was a bit lost when I started researching. This table on wikipedia was quite helpful for a first overview. But: JsUnit, JSTest, jsUnitTest, jsUnity - these are actually different frameworks, and there's even many more ...
I narrowed the selection down to those being currently developed, or are in use in "big" projects. JsUnit seems to be one of the major players, but I found almost no documentation, and the code base hasn't changed a lot in the last years. That's not a negative thing in itself, but having an active community around is a good thing. QUnit is used for testing JQuery, it looked like you could work with it as well, but its syntax and setup didn't make me go "wow" exactly. Same goes for JQUnit, about which I had read good stuff in several blog posts. It's also what Sammy.js is tested with.
I like RSpec, so when I had my first look at ScrewUnit, I was delighted to find there's BDD syntax for JavaScript too ...