Over a million developers have joined DZone.

Testing Tuesday Episode #16: Javascript Testing with Jasmine

DZone's Guide to

Testing Tuesday Episode #16: Javascript Testing with Jasmine

· Web Dev Zone ·
Free Resource

Bugsnag monitors application stability, so you can make data-driven decisions on whether you should be building new features, or fixing bugs. Learn more.


This is the 16th Testing Tuesday episode. Every week we will share our insights and opinions on the software testing space. Drop by every Tuesday to learn more! Last week we showed you how to set up Cucumber with standalone Ruby applications and Rails web applications.

How to test Javascript with Jasmine

We already tested Javascript in previous episodes with Selenium and Cucumber. Both frameworks perform integration tests by running a browser, interacting with the user interface and checking the outcome. Like the users of our web applications, these tests didn’t care if certain functionality was implemented in Javascript, in our backend application or at the database level.

This kind of testing is totally sufficient if you only implement occasional click-handlers and AJAX calls in Javascript. But once you start writing your own components like JQuery plugins or data models, you probably want to test them at a finer-grained level. That’s what Jasmine is for.

Jasmine is a unit testing framework for Javascript. Its syntax encourages behavior-driven development and looks similar to RSpec’s syntax. To get started with Jasmine we only need to download the latest version of the Jasmine Standalone.

In this screencast we’ll walk you through creating a little application using behavior-driven development with Jasmine.

Up Next Testing Tuesday: All About Jasmine Spies.

Next week we’ll show you how to use Jasmine spies to check if methods on Javascript objects got called or not. If you’ve got any questions or suggestions, please leave us a comment!

Further info:

Monitor application stability with Bugsnag to decide if your engineering team should be building new features on your roadmap or fixing bugs to stabilize your application.Try it free.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}