QUnit tests are great, but they only run in my browser locally. I want to be able to run these tests locally while developing yet still be able to hand those tests off for automated testing by Maven when my build is run..
What to do? Write a Maven plugin and share, of course!
Solution outline :
I then needed to capture the output of the test results on QUnit was finished running. Luckily, the QUnit framework provided handy callback functions that made this easy. Also, props to Rod for getting me started.
How to use:
Include the following in your Maven pom.xml configuration. See http://code.google.com/p/phantomjs-qunit-runner/ for detailed configuration documentation.
Finally, let’s see the magic happen! The plugin is tied to the Maven test lifecycle.
produces the following result
Success! .. well.. it’s a build failure, but that is the point as I deliberately had a test failure
Another nice feature is that it generates the HTML QUnit wrappers you would normally use when using QUnit. This should make development work even easier by being able to run your tests locally in your browser. Look in the Maven target/qunit-html folder.