I hereby decree

by David LeMieux

 

At work I've begun to use JS Test Driver to run JavaScript Unit and Functional tests. It was very easy to get up and running and it is more-or-less straight forward to use.

Specifically, I have been using the IntelliJ plug-in. It was easy to install and get started, but it does seem pretty finicky and there doesn't seem to be any reliable way to determine what version of JSTestDriver the plug-in uses, only the version of the plug-in itself.

I have never been big on test-driven development but I am starting to be converted to its ways. Of course I would test and validate that my code worked as expected, sometimes even putting it through peer review and a light layer of function stress testing. The idea of thinking about test in a more prominent way, however, is mostly new to me. So far I've found that it can be quite helpful.

My first positive experience came this week when I was writing a test for an already-in-production piece of code and the test failed. It failed on a strange edge case, but it failed nonetheless. This enabled me to fix the issue before anyone else could find in the "real world."

"Of course," you say, "this is what testing is supposed to do." But I feel like it takes "ah-ha" moments such as that to reinforce a concept and I had never had one with testing before.

If you are looking for a way to test your JavaScript code, give JS Test Driver a try. QUnit and JsUnit are also available though I have limited experience with the former and none with the later.

 

blog comments powered by Disqus