What is needed for decent test framework for JavaScript
I’ve been coding in JavaScript a lot lately. I’ve never thought that JavaScript a bad language per se, but it’s probably one the most misused language out there.
One thing that makes it difficult to write good, reusable JavaScript is the lack of a proper test framework. I’ve tried 3 some far: Blue-Ridge, Jasmine and JsTestDriver. They all have their benefits and issues. The reason that I write this post it that I don’t see any reasons why JS programmers can’t have their cake and eat too, meaning that it should be possible to build a frame work that combines all the benefits of the previously mentioned framework.
In my opinion, this not yet an existing framework would have the following features.
- Be agnostic to any JavaScript framework (jQuery, Prototype, etc)
- Be agnostic to the server side application (Rails, Django, etc)
- Be extensible so that you could deeply integrate it with a framework such as Rails. This would allow you to leverage awesome things like Rail’s generators.
- Support a command line only interpreter such as Chrome’s V8 or Mozilla’s Rhino.
- Support running tests in a Web Browser of your choosing for compatibility test.
- Automatically run tests in multiple browsers.
- Be fast.
- Takes less than one minute to deploy.
- Support for HTML fixtures, but does not require them.
The main thing that I haven’t seen any do so far is supporting a command line only interpreter such as V8 and allow the user to test their code in a browser of their choice. This is very important to me because I don’t want to launch a browser every time I run my tests (which happens 50+ times a day), but I want to be able to do so to resolve the pesky IE only bug.
I’m writing this because I hope to either start a project that meet these goals, or fork an existing one and add the missing parts to it. I would like some feedback on this to be sure I did not miss a use case, or that there is no such projects in existence that I’ve overlooked.