Giter Site home page Giter Site logo

qunit-mojo's Introduction

qunit-mojo

A maven plugin for quickly and easily creating, refactoring and running qunit tests

Goals:

  • qunit:test -> runs all your '*.qunit.js' or '*.qunit.coffee' files as qunit tests using phantomjs (or, optionally, qunit-test-driver)
  • qunit:serve -> starts an http server and serves your code so you can run it in the browser

Options:

  • -Dqunit.numThreads=N -> executes qunit tests in parallel using N threads, a 'C' suffix (e.g. 1C) will multiply by the number of cores on the system.
  • -Dqunit.filter=foo -> executes only those tests which have 'foo' in their name/path
  • -Dqunit.verbose=true/false -> logs verbose output for debugging (default=false)
  • -Dqunit.preserveTempFiles=true/false -> preserves generated temp files for with debugging (default=false)
  • -Dqunit.retryCount=N -> how many times to retry a test when phantomjs crashes (default=1)

Example:

/* src/main/foo/my-first-test.qunit.js */
define([], function(){
    test("my first failing test", function(){
        ok(false);
    });
});
stu@knox:~/projects/my-web-project mvn qunit:test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building my-web-project - com.cj.example:my-web-project:jar:0.0.1-SNAPSHOT
[INFO]    task-segment: [qunit:test]
[INFO] ------------------------------------------------------------------------
[INFO] [qunit:test {execution: default-cli}]
The extra paths are []
2013-06-21 14:03:04.270:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
2013-06-21 14:03:04.272:INFO::jetty-6.1.24
2013-06-21 14:03:04.284:INFO::Started [email protected]:8098
[INFO] Executing qunit tests on 1 thread(s) using phantomjs
[INFO] Running: my-first-test.qunit.js
Tests run: 1, Passed: 0, Failures: 1, Time elapsed: 22 ms <<< FAILURE!
2013-06-21 14:03:04.527:INFO::Stopped [email protected]:8098
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Problems found in 'my-first-test.qunit.js

[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Fri Jun 21 14:03:04 PDT 2013
[INFO] Final Memory: 12M/302M
[INFO] ------------------------------------------------------------------------

Setup:

<project>
      --- SNIP ---
    <build>
        <plugins>
            <plugin>
                <groupId>com.cj.qunit.mojo</groupId>
                <artifactId>qunit-maven-plugin</artifactId>
                <version>2.0.6</version>
                <executions>
                    <execution>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Notes:

  • coffeescript support is provided by the require-cs plugin.
    • If not using the default require config then you will need to make sure the plugin is available under the default 'cs' path.

qunit-mojo's People

Contributors

stupenrose avatar markw avatar finalfantasia avatar davidsiefert avatar eyusim avatar brandonbyskov avatar

Stargazers

 avatar Erik Schultink avatar Pushkar Gupte avatar cgp avatar

Watchers

 avatar Hal Arnold avatar  avatar  avatar Franklin Henderson avatar 0/∞ avatar Gaël Marziou avatar Bill Adams avatar Aaron Cave avatar Nicolás Font avatar James Cloos avatar Hitesh Lad avatar George Vamos avatar  avatar Anthony Coccia avatar Anale Shaba avatar  avatar Josh King avatar  avatar John Emmer avatar Dan Chong avatar  avatar Serra Allgood avatar  avatar Liz Hurley avatar Zhuocheng Yu avatar  avatar  avatar Jeegar Shah avatar  avatar Robert Duffy avatar  avatar Greg Wiley avatar Sam avatar Mircea avatar  avatar Mary avatar  avatar Vivek Sachdeva avatar Michael Adlai Arnold avatar jasmine samra avatar Cezar avatar Jeff To avatar  avatar JC Balcita avatar Fannzy avatar  avatar  avatar Jeremy Simpson avatar Mark B avatar Roscoe Huo avatar

qunit-mojo's Issues

Tests do not work using windows

The tests do not work using Windows. The problem is the backslash contained in the paths of the tests. it should be replaces with a slash either in in the java code (QunitMavenRunner) or in the phantomjs-run-qunit.js

url = url.replace(/\\/g,'/');

Specify multiple filters at once

Feature request: I'd like to run a set of qunit tests that match one of multiple filters.

Currenly you can run a set that matches only one filter with -Dqunit.filter=myFilter
Feature would be the ability to run with filters "myFilter" and "yourFilter", without running all the other tests, which might match "someOtherFilter".

Fail fast option

I would like have an option to have qunit stop running tests as soon as it hits the first failure it sees.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.