Chutzpah 1.3.0 Released

A new version of Chutzpah is now live on Visual Studio Gallery, CodePlex and now NuGet.

This release contains the following changes:

Features

1. Chutzpah is now able to run Jasmine tests in addition to QUnit. This was a large feature and new Chutzpah contributor Ben (Qube) did an amazing job with it.

2. Added a new configuration option to set the timeout on a test file. By default this value is 3000ms but there are many cases when you may have long running tests where you need this to be longer. You can now set this timeout from the command line:

chutzpah.console.exe /timeoutMilliseconds 5000 mytest.js

You can also set this inside of Visual Studio using the newly added options menu. You can find this menu under Tools->Options->Chutzpah.

image

 

Bug Fixes

1. Chutzpah now copies over the text fixtures that you set in your html test harness.

2. Added missing doctype on the generated test harness.

3. Fixed bug where multiple references to qunit.js were copied into the generated test harness.

Chutzpah 1.2.0 Released

A new version of Chutzpah is now live on Visual Studio Gallery, CodePlex and now NuGet.

This release contains the following changes.

1. Added the Chutzpah console runner as a NuGet package. Once installed the Chutzpah.Console.exe file will be located in the Tools directory of the Chutzpah package.

2. Added ability from command line and Visual Studio to have Chutzpah scan for test files when you execute it on a folder. This helps alleviate a pain point that arises when you break your JavaScript tests into multiple files. Before this change you would have to specify each file individually in the call to the console runner. Now it can take a folder name instead of a file name.

chutzpah.console.exe someFolder/jsTests

When Chutzpah sees that you provided a folder it will scan recursively within that folder for .js files and run any it believes are QUnit test files.

3. Fixed a bug that caused Chutzpah to error on read-only files. This can be quite common since many source control systems can put files in this state.

4. Added a command line flag /OpenInBrowser which makes Chutzpah open the test files in your default browser.  This can be helpful since it allows you to debug the tests more easily.

Make your website faster with RequestReduce

My co-worker Matt Wrock released an open source project on GitHub and Nuget called RequestReduce.  It is a very quick and easy way to dramatically improve the performance of an ASP.NET website. We use this library for our sites at work and after adding it we saw around an 18% improvement in global page load time.

RequestReduce works by examining the resources in an HTTP request and optimizes them before sending to the user. It will optimize them in the following ways (Matt Wrock’s own words):

  • Look for background images that it can sprite. This is the process of combining multiple images into a single image and using some CSS syntax to pull in specific images from that single file into a CSS class’s background.
  • Merge these images into a single PNG that is quantized down to 256 colors and then run through optipng for lossless compression. Unsatisfied with the quality I was getting from the popular opensource quantizers, I created a quantizer based on the Wu quantization algorithm and have released that separately as nQuant on codeplex. This often reduces the image size up to 3x smaller than the original.
  • Merges all CSS in the head and minifies it.
  • Manages the downloads of these CSS and image requests using ETag and expires headers to ensure optimal caching on the browser.

One of the nicest aspects of RequestReduce is how simple it is to start using. Just download the binaries to your website bin folder and add the following to your web.config:

<system.webServer>
 <modules runAllManagedModulesForAllRequests="true">
  <add name="RequestReduce" type="RequestReduce.Module.RequestReduceModule, RequestReduce, Version=1.0.0.0, 
  Culture=neutral" />
 </modules>
</system.webServer>

If you are interested I would definitely head over to the RequestReduce website to read the detailed documentation (including advanced configuration options) and the source code (yay for open source Smile ).

Chutzpah 1.1.0 Released

A new version of Chutzpah is now live on Visual Studio Gallery and CodePlex.

This release contains the following changes:

  • Added a “Run JS Tests in Browser” menu option inside of Visual Studio. This will open your default browser and run the selected QUnit test file.
  • Automatically save the test file in Visual Studio when you choose “Run JS Tests”
  • Added keyboard shortcut support for Visual Studio
    • Bind a shortcut to the ProjectAndSolutionsContextMenus.Project.RunJSTests command to run JS tests
  • Return line and column position for failed tests when you run a test JS file directly.
  • Upgraded to PhantomJS 1.2

Chutzpah – A JavaScript Test Runner Released

I just released to CodePlex and the Visual Studio Gallery a new project called Chutzpah (hutz·pah). Chutzpah is an open source JavaScript unit test runner which helps you integrate JavaScript unit testing into your website. It enables you to run JavaScript unit tests from the command line and from inside of Visual Studio. It also supports running in the TeamCity continuous integration server.

Backstory

About nine months ago I asked a question on StackOverflow about whether there were any tools/extensions which integrated into Visual Studio to run JavaScript unit tests. At that time there were no good solutions provided which led me to investigate creating my own tool. I explored many options but eventually I found the PhantomJS headless browser to help drive the tests.  After a couple weeks of development Chutzpah was born.

What does Chutzpah do?

Chutzpah is both a Visual Studio extension and a command line utility.

As a Visual Studio extension:

It allows you to run your JavaScript tests without leaving the IDE. It adds a context menu option to run tests directly from a source file.

RightMenu

It logs test results to both the Error list and the Output window.

errorWindow

outputWindow

As a command line utility:

It allows you to easily integrate test results into your build

commandLine

It also has support for the TeamCity continuous integration server so that you get detailed test output on every build.

How to use it?

Chutzpah is really easy to use, given QUnit tests (it only supports QUnit for now) you can run Chutzpah on the test harness HTML file and it will output the results. Chutzpah also supports running the tests directly from the JavaScript file as long as you add reference comments to the top of your test file.

For example given two files test.js (QUnit tests file) and code.js (implementation file).

code.js

var mathLib = {
    add5: function (a) {
        return a + 5;
    }
}

test.js

/// <reference path="code.js" />

test("will add 5 to number", function () {
    var res = mathLib.add5(10)

    equals(res, 15, "should add 5");
});

You can run the tests by right clicking and choosing “Run JS Test” if you are using the Visual Studio plugin, otherwise you can execute Chutzpah from the command line:

.\chutzpah.console.exe test.js

Community Support

I am really excited about releasing Chutzpah as an open source project with the hope of garnering support from the community. I would love to get feedback, bug reports, feature requests and code contributions. If you are interested in working on Chutzpah fork the code and get hacking.

Future Plans Ideas

At this stage I have many ideas of what features should come next for Chutzpah but outside of bug fixes I have no solid plans yet. Here are several ideas floating around in my head…

  1. Support other JavaScript unit test frameworks besides QUnit
  2. Expand past only using PhantomJS as the headless browser, possibly working with things like JsTestDriver or EnvJS.
  3. Be able to run individual tests instead of just a whole file.
  4. Add better IDE support like the Resharper 6 QUnit functionality.
  5. Add scanning for test files within a whole project hierarchy
  6. Support proxy servers
  7. Capture more detailed information from each test
  8. Integrate with existing test runners like MSTest or TestDriven.NET
  9. Add NuGet support