casperjs-runner-maven-plugin
This project aims to run CasperJS tests in a Maven build.
System requirements
This plugin has been tested on an environment where PhantomJS (v1.9.0) and CasperJS (v1.0.2) where installed.
Build
Download the sources, and build the plugin using the mvn clean install
command. You can build this plugin using Maven 2.2.x or Maven 3.x, and a JDK 1.6.
Usage
Add, in your <build><plugins>
part of your pom.xml
file the following part:
<plugin>
<groupId>com.github.linsolas</groupId>
<artifactId>casperjs-runner-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
</configuration>
</plugin>
Configuration
The CasperJS Runner Maven plugin can be configured with the following options:
Name | Description | Default value | Mandatory |
---|
casperjs.executable | Complete path of the executable for CasperJS. | None | Yes |
tests.directory | Directory where the tests to execute are stored. | None | Yes |
ignoreTestFailures | Do we ignore the tests failures. If yes, the plugin will not fail at the end if there was tests failures. | false | No |
include.javascript | A flag to indicate if the *.js found in tests.directory should be executed. | true | No |
include.coffeescript | A flag to indicate if the *.coffee found in tests.directory should be executed. | true | No |
verbose | Set the *plugin* to be verbose during its execution. It will not impact the verbosity of the CasperJS execution. | false | No |
You can also add in the <configuration>
part several elements that will be set as CasperJ options:
Name | Description |
---|
pre | Set the value for the CasperJS option --pre=[pre-test.js] : will add the tests contained in pre-test.js before executing the test suite. |
post | Set the value for the CasperJS option --post=[post-test.js] : will add the tests contained in post-test.js after having executed the whole test suite. |
includes | Set the value for the CasperJS option --includes=[foo.js,bar.js] : will includes the foo.js and bar.js files before each test file execution. |
xunit | Set the value for the CasperJS option --xunit=[filename] : will export test suite results in the specified xUnit XML file. |
logLevel | Set the value for the CasperJS option --log-level=[logLevel]: sets the logging level (see http://casperjs.org/logging.html). |
direct | Set the value for the CasperJS option --direct: will output log messages directly to the console. |
failFast | Set the value for the CasperJS option --fail-fast: will terminate the current test suite as soon as a first failure is encountered. |
engine | CasperJS 1.1 and above Set the for the CasperJS option --engine=[engine] : will change the rendering engine (phantomjs or slimerjs) |
TODO
Here is a list of things that should be done to make this plugin awesome:
- Set default values for some parameters (
tests.directory
for example) - Manage sub-directories where files are included
- Manage a list of excludes / includes for the tests to run
Issues / Enhancements
If you encounter issues or think about any kind of enhancements, you can add them in the adequate section of the project. Do not hesitate also to make Push Requests if you want to enhance this project.
License
This plugin is licensed with Apache License 2.0