This is a maven plugin for adding a qunit runner that will pick up your javascript tests and execute them.

Add the following to the <plugins> section of of your pom.xml


The qunit maven plugin supports most of the options that the surefire plugin supports such as <includes> and <exlcudes> and more.

You can also run the server to execute the tests manually by calling

mvn qunit:run-server

Requiring javascript libs for your test

The idea of the plugin is that you don't need to write the html boiler plate if you are simply unit testing javascript. But you need a way to include your javascript files to test.

Simply add the following to the top of your test and it will be pulled into the test html page generated.



Sometimes you need to test with a DOM structure. Qunit allows there to be a fixture section in the test page which is reset on every test method run.

If you simply add a {testname}-fixture.html file next to the test it will be picked up and used as the fixture html. eg. the test is called simple-test.js then the fixture should be called simple-test-fixture.html