Recently I've been doing more complex JavaScript coding. As part of the process, I wanted a better approach for JavaScript unit tests. After a Google I've settled on using QUnit, from the jquery guys.
QUnit runs in browser, which I wanted, since I like to test on an actual browser JavaScript engine; its closer to what the user experiences. I also wanted to be able to run the tests the same way I run .net tests; in my IDE (vstudio), but out of the box quint can't do that.
There are approaches to use QUnit with a server, but these focus on CI; a good thing; but not what I was after.
So, with a little code, and some convention, I use a simple mstest base class to start a web server, open a page, run quint, return the result. I also use a small bit of JavaScript to get QUnit to call back to my test, reporting results.
See the gist: qunit + mstest; using simple in-proc webserver (https://gist.github.com/2784505)
With this, I now run the unit test in v studio, same as normal tests. Too easy.
Friday, May 25, 2012
Subscribe to:
Posts (Atom)
A short list of C# coding issues.
Injecting services into entities It been bugging me for a while now that to use services in a entity can be a bit of pain. It usually starts...
-
Many developers that I work with avoid working with msbuild. This is a shame, since a little msbuild knowledge can go a long way. Her...
-
I've been experimenting with different guidelines to help me construct better code. In particular I've been pondering 'how to ...
-
Recently (VS2010) Microsoft introduced a technique for customising .config files (app.config, web.config) based on a target build / publish....