Erik A. Hanson's Weblog

Archive for the 'Javascript' Category

Big New Feature In JsUnit 2.2 alpha 25

Posted: Monday, August 13th, 2007    Tags: Javascript, JsUnit, Unit Testing

In order to run all test functions in a test page, JsUnit naturally needs to know what those test functions are. It’s able to get a list of those functions from Firefox, Safari and Opera, but it’s not able to get them from Internet Explorer. So in IE, JsUnit has to resort to searching the text of all scripts for strings that look like test function names. Unfortunately, it doesn’t understand comments so commented-out test functions will end up running anyway.

Minor New Features In JsUnit 2.2alpha24

Posted: Thursday, August 9th, 2007    Tags: Javascript, JsUnit, Unit Testing

I added a few new features to JsUnit and tagged it as version 2.2 alpha 24: new log button, new URL parameters, and easier suite creation.

A Ruby Script To Generate a JsUnit Suite

Posted: Saturday, May 26th, 2007    Tags: Howto, Javascript, JsUnit

I’ve got a bunch of JsUnit tests for a project I’m working on and I wanted an easy way to create a JsUnit suite that can run all the tests but also run any individual test page. Also, I wanted to be able to view any test page so I could debug the tests with Firebug. I also didn’t want to run a web server all the time, so I wanted a script that would create a static HTML file.

Element.stylize via Prototype.js

Posted: Friday, May 25th, 2007    Tags: Javascript, Web development

I often want to add a bunch of styles to an element, so I wrote a simple stylize method.

Debugging a JsUnit Test With Firebug

Posted: Thursday, November 16th, 2006    Tags: Howto, Javascript, JsUnit

Sometimes I find that I want to debug a JsUnit test because I’m not quite sure what’s going on in the browser. FireBug has a nice debugger, but I couldn’t get it to work with the JsUnit test runner. I could set breakpoints in JsUnit itself, but any breakpoints in my test would be ignored. And then it hit me: ditch the test runner.

Setting XSL Parameters from Javascript in AJAXSLT

Posted: Sunday, October 23rd, 2005    Tags: Howto, Javascript, XSL

Recently, I was trying to pass some info from my Javascript into my XSL stylesheet. Here’s how I finally did it.

A Mac OS X Web Browser for JavaScript Testing

Posted: Sunday, October 2nd, 2005    Tags: Javascript, My Software

I was playing with a very JavaScript-heavy web page and wanted my automated tests to use a real web browser. I tried running them inside Safari, but it’s a bit annoying to have my tests take control of my browser. Plus, there were caching issues. So I wrote a very simple web browser.

How To Use Google’s Ajaxslt Library

Posted: Friday, September 30th, 2005    Tags: Howto, Javascript, XSL

Google has written an open-source library called Ajaxslt that implements XPath and XSLT in Javascript. It took a bit of playing to get it to work.