(Disclaimer: I am a noob myself) Should you follow Test Driven Development (TDD) when you are just a beginner? Well that’s exactly the right time to start, because it is always easier to learn than unlearn. I came across this choice while building a REST API backend for a project I am a part of. Here is my research.

List of Options: QUnit, Unitjs, Mocha, Chakram, Frisbyjs et cetera

Just considering Chakram and Frisbyjs because all others are testing frameworks in a more general sense, for testing everything in your javascript app. We just need to test our API endpoints, so we don’t need all the extra code.

Chakram is built on Mocha and Chai, and here is a sample code for I don’t know what:

it("should expose any errors in the chakram response object", function () {
 return chakram.get("not-valid")
 .then(function(obj) {
     expect(obj.error).to.exist.and.to.be.a("object");
 }); 

Notice the amount of syntax that we will have to learn in order to write a test which doesn’t even make sense (to noobs) in first glance. Negative points to Chakram. And no way to test Multipart uploads. ‘Nuff said. (Check this full API tests)

On the other hand, Frisbyjs’ code sample:

frisby.create('Ensure we are dealing with a teapot')
  .get('http://httpbin.org/status/418')
    .expectStatus(418)
.toss()

Simple, nice and intuitive! Also supports Multipart uploads and file streams.

I rest my case.