Unit Testing javascript

From MapbenderWiki

Jump to: navigation, search

Write a testfile as described here: http://docs.jquery.com/QUnit

and include

 prefix = environment['user.dir'];
 load(prefix +  "/tools/testframework.js");

As well as

load(prefix + "../http/javascript/mod_test.js") 

at the top to load the testframework and the file you want to test

then add a line like:

 java -jar env-js/rhino/js.jar javascript/test.js

to "tests/Makefile" and execute

make jstest

in the tests directory


This process can probably be greatly improved, but for now this works

Views
Personal tools