tisdag 5 februari 2008

Fixin', Hackin' , Patchin' & givin' up...

I've been trying to get the Crosscheck-framework now. I've solved the problem mentioned in the last post by patching jQuery. It turned out the problem was the how Crosscheck enumerates js-objects. Anyways, once that problem was solved a new one emerged. I was planning on submitting all the fixes for these problems here, but now I reached the point were giving up was the only option. There is no use in trying to get the framework to play with the jQuery-library; the differences between crosscheck and the real browser is to big. Sadly enough.

So what to do next? Either we have to go over to in-browser-testing and in that case I figure we'll go with JSSpec, which is a behavior-driven javascript testing framework. But that is the last resort; if we do our tests in the browser the CI-process is practically impossible. Which means we'll end up not running the javascript-tests, which is kind of equal to not testing at all. The other possiblity is to look at other 'browser simulators'.

John Resig, one of the most quoted javascript gurus here at the office (the other one being Douglas Crockford ), presented an interesting alternative in his blogpost Bringing the Browser to the Server. In this post he supplies a simple browser enviroment to be used together with Rhino (Mozilla's server side javascript runtime). This could then be used for javascript testing. I tried it out, but as he claims in the post, it only supplies the very basic and therefore some important things are missing. I really have to pay my respects to Resig though, the existing work is real nice and if he decides to continuing the work on it, it'll definitely be worth checking out.

So for now we can't go with crosscheck and we can't go with resig's solution. Unfortunately. Next thing to check out is the HtmlUnit framework. It has some SoundCloud specific drawbacks, one of them being that it's written in java, but on the flipside is that their developers have tried it with different versions of jQuery and it seeems to work. So expect to hear more about HtmlUnit from me.

2 kommentarer:

Unknown sa...

Have you thought about using selenium to kick start in-browser tests on your CI process?

theneubeck sa...

@zap: yeah, but then we need some kind of UI on the server. See we want to have the javascripttesting run on every commit on a remote machine. It seemed possible with crosscheck, but there is to much gaps between the reality and them for it to be useful for us at this stage.