views:

45

answers:

3

I want to unit test the javascript I have embedded in the webapp portion of my liftweb project. Liftweb is a subset of the maven webapp archetype, so my question applies to that framework as well.

By 'good', I mean that the tests can be integrated into the maven automated testing.

I understand that different browsers support different versions of ecmascript, so I am okay with a testing solution that restricts itself to one specific version.

+3  A: 

JSUnit might help with JavaScript testing.

duffymo
+1. And here is the plugin: http://jsunit.berlios.de/maven2.html
Pascal Thivent
This appears to test javascript under src/main/javascript, not under the src/main/webapp. Is that easy to change?
Fred Haslam
@Fred According to the above link, the default source directory seems to be `${basedir}/src/main/webapp/js`
Pascal Thivent
A: 

I like QUnit for testing javascript. I have no idea how well it fits in with the maven test automation tools. I do know that you can extract the test results in a format that is more friendly to automated builds.

Typical solutions I've seen for including javascript with other forms of automated testing utilize a tool like Selenium or WATiR/WATiN to fire up a browser and execute the tests. Of course there is also TestSwarm if you want a way to test javascript against multiple browsers in an automated fashion, but again I am not sure what the capabilities are as far as integrating with other automated testing systems.

ckramer
A: 

Some things that you may find helpful in testing your javascript applications:

Jamie Wong