Hold up, what’s TDD?
TDD stands for Test-Driven Development. The idea is that instead of writing code and figuring out how to test it later, why not write the test first and work backwards? You may have also heard of BDD — Behavior-Driven Development. There’s little difference besides the conceptual approach. In TDD, you write tests first and make them pass, in BDD, you describe behaviors and then make them pass.
Okay! So the general issue with saying “here’s a tool! neat!” is that it leads to wondering how the heck you’re going to use it. So I was excited to see Murphey’s js-assessment repo, which reminds me of the Ruby Koans, except without the Zen, and also more beginner friendly, since its dependence on the command-line is far less than the Koans (unless you do them in the browser, but then there’s no saving). js-assessment uses Mocha for testing, and a few other dependencies of things I’ve personally wanted to check out. Note, the command line test support was a little wonky when I tried to use it, but a beauty of JS is that one just needs to refresh the test page to see new results.
Give it a try!
I’m interested to see the results of Shore’s project (19 days to fund!) once I’ve worked through js-assessment (and pondered making my own koans-style version …). I’m perhaps more interested to hear what kinds of JS testing and TDD you all have been doing!