Test Driven JavaScript development with Jasmine
Given the important role that Behaviour Driven Design (BDD) plays in software development, it’s about time a testing framework came along to make the process of testing your JavaScript applications quicker, easier and more intuitive.
That’s why we were pleased when we heard about Jasmine, a lightweight framework that has no dependencies on other JavaScript frameworks. We now use it as part of our testing process and we’ve found it’s made a big difference to the efficiency of our testing and saved us even more time.
Jasmine has been designed with the following principles in mind (as described on their GitHub page*):
- It shouldn’t be tied to any browser, framework, platform or host language
- It should have unsurprising syntax
- It should work anywhere JavaScript can run, including browsers, servers and phones
- It shouldn’t intrude in your application’s territory (such as cluttering the global namespace)
This framework has played a valuable role in helping us write clean tests, which are fast, easy to read and executable in any environment. The slick interface makes it clear in terms of which of your tests have passed and which have failed.
Take a look at the Syntax at http://pivotal.github.io/jasmine/ or even try it in your browser without any setup using http://tryjasmine.com
Written by Anton Rand, Software Engineer at Dotted Eyes, 20th November 2013