January 03, 2014
Integration Testing in Node.js
What's the best way to run integration tests on an AJAX-heavy website?
If you think that's just a lot of hipster coder buzwords, wait... there's more.
This morning I broke pencilcode.net due to a code change: while refactoring the editor source code to use proper require.js organization, I messed up by bringing in an old version of seedrandom that wasn't compatible with AMD loading. Seedrandom is my own library, and so it was doubly my own fault! The result was that all password checking was broken on the site for a few hours. The bug took about 10 minutes to fix: I just had to use bowercopy to upgrade seedrandom to its latest bower package, then run the requirejs optimizer, then redeploy.
But the real bug? I don't have any integration tests on pencilcode.net. I should have never pushed broken passwords in the first place. While I have some little unit tests, I really need end-to-end integration tests that bring up the whole website, browse it with a headless browser, and click around authenticating and editing and running and saving, to make sure it all works as expected.
How do I run tests that exercise the whole system end-to-end? Maybe something like travist's jquery.go.js? Has anybody found the right way to do integration tests in the node.js world?
|Copyright 2014 © David Bau. All Rights Reserved.|