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.


Requiring CSS stylesheets for your test

If you need to include a css stylesheet you can include an external CSS stylesheet or one bundled in your application.

Simply add the following to the top of your test and it will be pulled into the test 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

Resource locations

By default the plugin will use the maven projects test class elements and look for resources there. If you want to override the resource locations or wish to be able to alter tests without having to restart the run-server goal you can specify a resourceLocations section in the configuration.