Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/philmander/ant-jstestrunner
Ant task to automate JS unit testing
https://github.com/philmander/ant-jstestrunner
Last synced: about 1 month ago
JSON representation
Ant task to automate JS unit testing
- Host: GitHub
- URL: https://github.com/philmander/ant-jstestrunner
- Owner: philmander
- License: mit
- Created: 2012-05-12T18:30:44.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2015-01-24T23:28:05.000Z (almost 10 years ago)
- Last Synced: 2023-03-11T11:17:22.589Z (almost 2 years ago)
- Language: JavaScript
- Size: 12.4 MB
- Stars: 14
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license.txt
Awesome Lists containing this project
README
#This project is deprecated
I won't being performing any maintanence on this project other than merging pull requests that merge automatically.
Node.JS projects such as Karma + PhantomJS or via Browserify are better suited to unit testing JS projects these days.
---
#JSTestRunner Ant Task
Automate Javascript unit tests with Apache Ant. The task uses [Phantom JS](http://phantomjs.org/), a headless webkit browser, to open and run html unit test files. Any test failures will (optionally) cause a build to fail.
NB: Currently support is limited to [QUnit](http://docs.jquery.com/Qunit).
To get started [download](https://github.com/micmeyer/ant-jstestrunner/releases) the latest ant-jstestrunner jar file, get a [copy of Phantom JS](http://code.google.com/p/phantomjs/downloads/list) and include the following code in your Ant build file.
```xml
```
##Parameters
###Task attributes
Attribute | Description | Required
------------ | ----------- | ------------------
dir | The directory to scan for test files | yes
phantomWin | The location of the Phantom JS executable when running on Windows* | yes (if running on Windows)
phantomMac | The location of the Phantom JS executable when running on a Mac* | yes (if running on Mac)
phantomLinux | The location of the Phantom JS executable when running on a Linux* | yes (if running on Linux)
fail | Instructs the task to fail the build if there are any JS test failures or errors | no (defaults to true)The task is an implicit fileset. See http://ant.apache.org/manual/Types/fileset.html for more parameters used for file matching or see the usage examples below.
\* The task is not bundled with Phantom JS, you must specify its location. To ensure the build is portable across different operating systems you must specify the location of the Phantom JS executable for each OS the build may run on.
It is recommended to include the Phantom JS executables within your project.###Nested elements
####report
Attribute | Description | Required
------------ | ----------- | ------------------
type | The type of report (currently 'plain' and 'junit' are supported) | no (defaults to 'plain')
destFile | The file to write the report to | yes##Usage examples
###Typical fileset
Run JS test files. In this example a convention is used where all JS test files have the -test.html suffix```xml
```
###Stop tests failing the build
If you wish, the task can be set to not fail the build if any assertion failures or errors are found.```xml
```
###Write results to a file
```xml
```
## Running the task in Maven
Ant-jstestrunner isn't deployed to the Maven Central Repository yet, but you can install locally either by cloning the
project and running`mvn install`
or downloading the jar release and running
`mvn install:install-file -Dfile=/path/to/ant-jstestrunner-0.1.deps.jar -DgroupId=com.philmander.jstest.ant -DartifactId=ant-jstestrunner -Dversion=0.1 -Dpackaging=jar`
Now use the antrun plugin to add the js test runner to your Maven build
```xml
org.apache.maven.plugins
maven-antrun-plugin
1.7
jstest
test
run
com.philmander.jstest.ant
ant-jstestrunner
0.1
```
## Fork and run locally ##Ant-Jstestrunner is built using Apache Maven.
To run tests against your code run `mvn test`
To create a jar file run `mvn package`