A couple of months ago I linked to a presentation on advanced unit testing techniques for front-end JavaScript using Jasmine. This week I did a presentation for a client using QUnit instead, covering roughly the same subjects: Mocking and spy techniques to avoid dependencies on Functions, methods and constructor functions Time (new Date()) Timers (setTimeout,… Read More

Unit testing front-end JavaScript presents its own unique set of challenges. Yesterday we had another event in the Test Driven Developers Bay Area meetup group. At this event I presented a number of different techniques to tackle these challenges and make our JavaScript unit tests fast and robust using Jasmine (another version using QUnit). I… Read More

I’ve previously described how to run your QUnit tests and produce a coverage report on every commit. This works great if you happen to have chosen QUnit as your unit testing framework. Jasmine is another popular JavaScript unit testing framework. Here I will show how you can get the same automated feedback from your Jasmine… Read More

Being able to get fast feedback from failing unit tests is useful. And if you could easily identify the parts of your code that you still need to write tests for, you would get more comprehensive feedback. There is a plugin for Grunt that can use the JSCoverage tool to produce a coverage report while… Read More

Being able to check the quality of your code and run all unit tests in your project on every commit is useful. If you could do it on every save you would get even faster feedback. Grunt includes a watch facility that will run a task every time some file is changed. You only need… Read More

Being able to check the quality of your code on every commit is useful. But it would be even more useful if you could also run all your unit tests on every commit. Here I will show how you can extend the automated build setup to also run all your QUnit tests. (Switch to different… Read More

Update as of April 7, 2013: This blog series has now been extended with Jasmine and Istanbul. Update as of March 28, 2013: This blog series has now been upgraded to use Grunt-0.4. A lot of projects use continuous integration these days. It is still far more common for back-end projects using C#, Java or… Read More

I gave another presentation at the Test Driven Developers meetup group on Unit Testing in JavaScript using MVC and QUnit (slides below). Sample source code can be downloaded here. Looking forward to our next event on June 23rd, a TDD Coding Dojo hosted by Olve Maudal. Unit Testing in JavaScript with MVC and QUnit View… Read More