Unit Testing JS with Jasmine and Chutzpah

Gone are the days where we will manually test our web sites specially if its using Javascript. Since the arrival of QUnit, Jasmine, and Mocha  the way we test the client side of our sites has changed. Now for this post I will be using Jasmine. Why Jasmine? Because, it support’s Ajax testing. I am not saying that you cannot test ajax results from the other 2 frameworks but Jasmine is just my favorite.

And if you want to integrate it with visual studio with a test runner, let’s use another open source tool

1. Okay first let’s add our test runner to visual studio.

– Go to Tools > Extensions and updates and search for Chutzpah

– Now you should see 2 results. The first one is the Test Adapter and the second is an addition to the context menu. Download them both.


2. Lets get Jasmine using from Github.

– Go to your github command line and clone it from https://github.com/pivotal/jasmine.git. And add a reference to Jasmine into your solution.



– Now that I have Jasmine, and with the help of Chutzpah. I can now create a simple test run in test explorer.



Now, how about that? Easy isn’t it? As I said before, you can even test your ajax requests with Jasmine. The beautiful part is with the help of Chutzpah, I was able to load all these javascript test items into the test explorer. If you like my post, please go to my site as well www.francorobles.com.



Author: francorobles

A soon to be jedi in the art of software development...

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s