Saturday, June 26, 2010

JavaScript unit tests in Eclipse

Anybody knows what's currently the most popular tool for javascript unit testing?

While figuring this out, I made up a simple javascript unit tests integration with Eclipse to easily run precious tests from my favourite environment :-)



Unit tests are simple objects with functions to test and there's a couple of JUnit-style assertions. I wonder if the above view could be integrated with some real JS unit test tool.

4 comments:

  1. There's JsUnit (http://www.jsunit.net/), jsTest (http://thinkpond.org/articles/2008/jstest-intro.shtml) and JsTestDriver (http://misko.hevery.com/2009/12/04/there-are-lots-of-ways-to-tests-your-javascript-but-there-is-only-one-jstestdriver/)

    ReplyDelete
  2. Nice one Jacek!

    Does this plugin run with ATF's or/and WTP's implementations? I think of a nice product to host this plugin ;)

    ReplyDelete
  3. For pure JavaScript and Eclipse integration there's one I use in the e4 repo -- org.eclipse.e4.languages.javascript.junit.

    It really is just providing a specialized TestCase and using Rhino and JUnit under the covers and does not handle one clicking on a unit test to take you to source. With that said its very fast and works well enough for me and I've used it for 100s of tests.

    ReplyDelete