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

Jumpstart your Angular applications with Indigo.Design, a unified platform for visual design, UX prototyping, code generation, and app development.


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:

Take a look at an Indigo.Design sample application to learn more about how apps are created with design to code software.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}