Foray into TDD/BDD

laboratory-glassware-13792643839YO

I am starting a new programming project and have decided to use TDD and BDD as much as possible. Even though I currently suck at it, I think I am a convert. The confluence of testing automation, test writing, and spec writing is irresistible.

I only need to concern myself with JavaScript at the moment, so for my tooling I’m using Testem for test automation, Mocha for the testing framework, and Chai for the assertion library. I will probably have to delve into Sinon.js as well for mocks and other stuff. Personally, I’d be happy to use the the older and integrated Jasmine framework instead of the mix-and-match Mocha+Chai+Sinon.JS trinity, but Jasmine seems to be getting bad press lately for being stalled and for having clumsy async teset handling.

A Nettuts+ video on Testem helped make setting up easy. You should note that Testem has a "framework": "mocha+chai" option that makes it unnecessary to download chai.js.

So far, my code-to-test-code ratio is about 1 to 1.5. I have no idea if that’s typical.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.