Many developers and development shops have embraced testing in their server side code – either using a TDD model, or sometimes just with unit or functional tests created on the fly – but very few developers I talk to test their front end code beyond eyeballing it in a few browsers (or if they’re lucky, with a service like BrowserStack). And even fewer of those use any kind of automation. In this post I’m going to try and help out that majority of you who aren’t testing – or maybe just aren’t automating.
Lately I’ve been converting a number of my jQuery plugins over to Github – something the new jQuery plugin site is requiring – and while doing so I’m refactoring and adding tests with QUnit(created by the same folks that write the jQuery core). I realized pretty quickly that having to go to the browser, hard refresh, and then run the tests again after every change was a time killer, but I didn’t want to write a whole bunch of tests and then go check the results, otherwise I could be tracking down bugs (in my code and the tests) for days. Instead I set up some automated testing using Grunt, PhantomJS, and a couple Grunt plugins. Here’s how.
Your new post is loading...