Fork me on GitHub

jasmine:test

Full name:

com.github.searls:jasmine-maven-plugin:2.2:test

Description:

Execute specs using Selenium Web Driver. Uses PhantomJsDriver for head-less execution by default.

Attributes:

  • Requires a Maven project to be executed.
  • Requires dependency resolution of artifacts in scope: test.
  • Binds by default to the lifecycle phase: test.

Optional Parameters

Name Type Since Description
additionalContexts List 1.3.1.5

Specify additional contexts to make available.

<additionalContexts>
  <context>
    <contextRoot>lib</contextRoot>
    <directory>${project.basedir}/src/main/lib</directory>
  </context>
  <context>
    <contextRoot>test/lib</contextRoot>
    <directory>${project.basedir}/src/test/lib</directory>
  </context>
</additionalContexts>

autoRefreshInterval int 1.3.1.1

Automatically refresh the test runner at the given interval (specified in seconds) when using the jasmine:bdd goal.

A value of 0 disables the automatic refresh (which is the default).


Default value is: 0.
User property is: jasmine.autoRefreshInterval.
browserVersion String 1.1.0 Deprecated. Use the webDriverCapabilities parameter instead.
Default value is: FIREFOX_17.
coffeeScriptCompilationEnabled boolean 1.3.1.4

Control the Coffee Script compilation. e.g. When using RequireJS the compilation happens within the Coffee Script AMD loader plugin; we therefore need to disable the compilation here.


Default value is: true.
User property is: coffeeScriptCompilationEnabled.
connectorClass String 1.3.1.4

Type of Connector to use on the jetty server.


Most users won't need to change this from the default value. It should only be used by advanced users.


Default value is: org.eclipse.jetty.server.nio.SelectChannelConnector.
User property is: jasmine.connectorClass.
customRunnerConfiguration String 1.1.0

Sometimes you want to have full control over how scriptloaders are configured. In order to interpolate custom configuration into the generated runnerTemplate, specify a file containing the additional config. Potential values are a filesystem path, a URL, or a classpath resource.


Example usage:

<customRunnerConfiguration>${project.basedir}/src/test/resources/myCustomConfig.txt</customRunnerConfiguration>

customRunnerTemplate String 1.1.0

It may be the case that the jasmine-maven-plugin doesn't currently suit all of your needs, and as a result the generated SpecRunner HTML files are set up in a way that you can't run your specs. Have no fear! Simply specify a custom spec runner template in the plugin configuration and make the changes you need.


Potential values are a filesystem path, a URL, or a classpath resource. The default template is stored in src/main/resources/jasmine-templates/SpecRunner.htmltemplate, and the required template strings are tokenized in "$*$" patterns.


Example usage:

<customRunnerTemplate>${project.basedir}/src/test/resources/myCustomRunner.template</customRunnerTemplate>

debug boolean 1.1.0 True to increase HtmlUnit output and attempt reporting on specs even if a timeout occurred.
Default value is: false.
fileSystemReporters List -

Specify a custom file system reporter to be used to store the test report.

Example usage:

<fileSystemReporters>
  <reporter>
    <fileName>MyFile.log</fileName>
    <reporterName>${project.basedir}/src/test/resources/myCustomReporter.js</reporterName>
  </reporter>
  <reporter>
    <fileName>Test-jasmine.xml</fileName>
    <reporterName>JUNIT_XML</reporterName>
  </reporter>
</fileSystemReporters>

format String 1.1.0

Determines the format that jasmine:test will print to console.

Valid options:

  • "documentation" - (default) - print specs in a nested format
  • "progress" - more terse, with a period for a passed specs and an 'F' for failures (e.g. '...F...')

Default value is: documentation.
haltOnFailure boolean 1.1.0 Halt the build on test failure.
Default value is: true.
User property is: haltOnFailure.
jasmineTargetDir File 1.1.0 Target directory for files created by the plugin.
Default value is: ${project.build.directory}${file.separator}jasmine.
jsSrcDir File 1.1.0 Directory storing your JavaScript.
Default value is: ${project.basedir}${file.separator}src${file.separator}main${file.separator}javascript.
User property is: jsSrcDir.
jsTestSrcDir File 1.1.0 Directory storing your Jasmine Specs.
Default value is: ${project.basedir}${file.separator}src${file.separator}test${file.separator}javascript.
User property is: jsTestSrcDir.
keepServerAlive boolean 1.3.1.0 Keep the server alive after the jasmine:test goal exists. Useful if you need to run further analysis on your tests, like collecting code coverage.
Default value is: false.
User property is: keepServerAlive.
manualSpecRunnerHtmlFileName String 1.1.0 The name of the Manual Spec Runner.
Default value is: ManualSpecRunner.html.
mvnTestSkip boolean 1.3.1.3 Skip compilation and execution of tests.
User property is: maven.test.skip.
phantomjs PhantomJsOptions 2.0

Configure which version of PhantomJS should be used and how it should be found. The core of the phantomjs-maven-plugin is used to provide this functionality and this parameter should match the configuration of the phantomjs-maven-plugin install goal.


Default Options:

<phantomjs>
  <version>2.0.0</version>
  <checkSystemPath>true</checkSystemPath>
  <enforceVersion>true</enforceVersion>
  <source>REPOSITORY</source>
  <baseUrl></baseUrl>
  <outputDirectory>target/phantomjs</outputDirectory>
</phantomjs>

Default value is: ${phantomJs}.
User property is: phantomjs.
preloadSources List 1.1.0

JavaScript sources (typically vendor/lib dependencies) that need to be loaded before other sources (and specs) in a particular order. Each source will first be searched for relative to ${jsSrcDir}, then ${jsTestSrcDir}, then (if it's not found in either) it will be included exactly as it appears in your POM.


Therefore, if jquery.js is in ${jsSrcDir}/vendor, you would configure:

<preloadSources>
  <source>vendor/jquery.js</source>
</preloadSources>

And jquery.js would load before all the other sources and specs.


reporters List -

Specify a custom reporter to be used to print the test report.

Example usage:

<reporters>
  <reporter>
    <reporterName>${project.basedir}/src/test/resources/myCustomReporter.js</reporterName>
  </reporter>
  <reporter>
    <reporterName>STANDARD</reporterName>
  </reporter>
</reporters>

serverHostname String 1.3.1.4

Not used by the jasmine:bdd goal.


The jasmine:test goal to specify hostname where the server is running. Useful when using the RemoteWebDriver.


Default value is: localhost.
User property is: jasmine.serverHostname.
serverPort int 1.1.0

Used by the jasmine:bdd goal to specify port to run the server under.


The jasmine:test goal always uses a random available port so this property is ignored.


Default value is: 8234.
User property is: jasmine.serverPort.
skipJasmineTests boolean 1.3.1.3 Skip only jasmine tests
User property is: skipJasmineTests.
skipTests boolean 1.1.0 Skip execution of tests.
User property is: skipTests.
sourceEncoding String 1.1.0 The source encoding.
Default value is: ${project.build.sourceEncoding}.
sourceExcludes List 1.1.0

Just like sourceIncludes, but will exclude anything matching the provided patterns.

There are no sourceExcludes by default.


sourceIncludes List 1.1.0

Allows specifying which source files should be included and in what order.

<sourceIncludes>
  <include>vendor/**/*.js</include>
  <include>myBootstrapFile.js</include>
  <include>**/*.js</include>
  <include>**/*.coffee</include>
</sourceIncludes>

Default sourceIncludes:

<sourceIncludes>
  <include>**/*.js</include>
  <include>**/*.coffee</include>
</sourceIncludes>

specDirectoryName String 1.1.0 The name of the directory the specs will be deployed to on the server.
Default value is: spec.
specExcludes List 1.1.0

Just like specIncludes, but will exclude anything matching the provided patterns.

There are no specExcludes by default.


specIncludes List 1.1.0

I often find myself needing control of the spec include order when I have some global spec helpers or spec-scoped dependencies, like:

<specIncludes>
  <include>jasmine-jquery.js</include>
  <include>spec-helper.js</include>
  <include>**/*.js</include>
  <include>**/*.coffee</include>
</specIncludes>

Default specIncludes:

<specIncludes>
  <include>**/*.js</include>
  <include>**/*.coffee</include>
</specIncludes>

specRunnerHtmlFileName String 1.1.0 The name of the Spec Runner file.
Default value is: SpecRunner.html.
specRunnerTemplate SpecRunnerTemplate 1.1.0

Determines the strategy to use when generation the JasmineSpecRunner. This feature allows for custom implementation of the runner generator. Typically this is used when using different script runners.


Some valid examples: DEFAULT, REQUIRE_JS


Default value is: DEFAULT.
User property is: jasmine.specRunnerTemplate.
srcDirectoryName String 1.1.0 The name of the directory the sources will be deployed to on the server.
Default value is: src.
timeout int 1.1.0 Timeout for spec execution in seconds.
Default value is: 300.
uriScheme String 1.3.1.4

Specify the URI scheme in which to access the SpecRunner.


Default value is: http.
User property is: jasmine.uriScheme.
webDriverCapabilities List 1.3.1.1

Web driver capabilities used to initialize a DesiredCapabilities instance when creating a web driver.


Capabilities value can be either a String, a List, or a Map.


Example:

<webDriverCapabilities>
  <capability>
    <name>phantomjs.binary.path</name>
    <value>/opt/phantomjs/bin/phantomjs</value>
  </capability>
  <capability>
    <name>phantomjs.cli.args</name>
    <list>
      <value>--disk-cache=true</value>
      <value>--max-disk-cache-size=256</value>
    </list>
  </capability>
  <capability>
    <name>proxy</name>
    <map>
      <httpProxy>myproxyserver.com:8000</httpProxy>
    </map>
  </capability>
</webDriverCapabilities>

webDriverClassName String 1.1.0 Determines the Selenium WebDriver class we'll use to execute the tests. See the Selenium documentation for more details. The plugin uses PhantomJSDriver by default.

Some valid examples:

  • org.openqa.selenium.htmlunit.HtmlUnitDriver
  • org.openqa.selenium.phantomjs.PhantomJSDriver
  • org.openqa.selenium.firefox.FirefoxDriver
  • org.openqa.selenium.ie.InternetExplorerDriver

See the webDriverCapabilities property for configuring driver specific properties.
Default value is: org.openqa.selenium.phantomjs.PhantomJSDriver.

Parameter Details

additionalContexts:

Specify additional contexts to make available.

<additionalContexts>
  <context>
    <contextRoot>lib</contextRoot>
    <directory>${project.basedir}/src/main/lib</directory>
  </context>
  <context>
    <contextRoot>test/lib</contextRoot>
    <directory>${project.basedir}/src/test/lib</directory>
  </context>
</additionalContexts>
  • Type: java.util.List
  • Since: 1.3.1.5
  • Required: No

autoRefreshInterval:

Automatically refresh the test runner at the given interval (specified in seconds) when using the jasmine:bdd goal.

A value of 0 disables the automatic refresh (which is the default).

  • Type: int
  • Since: 1.3.1.1
  • Required: No
  • User Property: jasmine.autoRefreshInterval
  • Default: 0

browserVersion:

Deprecated. Use the webDriverCapabilities parameter instead.

Determines the browser and version profile that HtmlUnit will simulate. This setting does nothing if the plugin is configured not to use HtmlUnit. This maps 1-to-1 with the public static instances found in BrowserVersion.


Some valid examples: CHROME, FIREFOX_17, INTERNET_EXPLORER_9, INTERNET_EXPLORER_10

  • Type: java.lang.String
  • Since: 1.1.0
  • Required: No
  • Default: FIREFOX_17

coffeeScriptCompilationEnabled:

Control the Coffee Script compilation. e.g. When using RequireJS the compilation happens within the Coffee Script AMD loader plugin; we therefore need to disable the compilation here.

  • Type: boolean
  • Since: 1.3.1.4
  • Required: No
  • User Property: coffeeScriptCompilationEnabled
  • Default: true

connectorClass:

Type of Connector to use on the jetty server.


Most users won't need to change this from the default value. It should only be used by advanced users.

  • Type: java.lang.String
  • Since: 1.3.1.4
  • Required: No
  • User Property: jasmine.connectorClass
  • Default: org.eclipse.jetty.server.nio.SelectChannelConnector

customRunnerConfiguration:

Sometimes you want to have full control over how scriptloaders are configured. In order to interpolate custom configuration into the generated runnerTemplate, specify a file containing the additional config. Potential values are a filesystem path, a URL, or a classpath resource.


Example usage:

<customRunnerConfiguration>${project.basedir}/src/test/resources/myCustomConfig.txt</customRunnerConfiguration>
  • Type: java.lang.String
  • Since: 1.1.0
  • Required: No

customRunnerTemplate:

It may be the case that the jasmine-maven-plugin doesn't currently suit all of your needs, and as a result the generated SpecRunner HTML files are set up in a way that you can't run your specs. Have no fear! Simply specify a custom spec runner template in the plugin configuration and make the changes you need.


Potential values are a filesystem path, a URL, or a classpath resource. The default template is stored in src/main/resources/jasmine-templates/SpecRunner.htmltemplate, and the required template strings are tokenized in "$*$" patterns.


Example usage:

<customRunnerTemplate>${project.basedir}/src/test/resources/myCustomRunner.template</customRunnerTemplate>
  • Type: java.lang.String
  • Since: 1.1.0
  • Required: No

debug:

True to increase HtmlUnit output and attempt reporting on specs even if a timeout occurred.
  • Type: boolean
  • Since: 1.1.0
  • Required: No
  • Default: false

fileSystemReporters:

Specify a custom file system reporter to be used to store the test report.

Example usage:

<fileSystemReporters>
  <reporter>
    <fileName>MyFile.log</fileName>
    <reporterName>${project.basedir}/src/test/resources/myCustomReporter.js</reporterName>
  </reporter>
  <reporter>
    <fileName>Test-jasmine.xml</fileName>
    <reporterName>JUNIT_XML</reporterName>
  </reporter>
</fileSystemReporters>
  • Type: java.util.List
  • Required: No

format:

Determines the format that jasmine:test will print to console.

Valid options:

  • "documentation" - (default) - print specs in a nested format
  • "progress" - more terse, with a period for a passed specs and an 'F' for failures (e.g. '...F...')
  • Type: java.lang.String
  • Since: 1.1.0
  • Required: No
  • Default: documentation

haltOnFailure:

Halt the build on test failure.
  • Type: boolean
  • Since: 1.1.0
  • Required: No
  • User Property: haltOnFailure
  • Default: true

jasmineTargetDir:

Target directory for files created by the plugin.
  • Type: java.io.File
  • Since: 1.1.0
  • Required: No
  • Default: ${project.build.directory}${file.separator}jasmine

jsSrcDir:

Directory storing your JavaScript.
  • Type: java.io.File
  • Since: 1.1.0
  • Required: No
  • User Property: jsSrcDir
  • Default: ${project.basedir}${file.separator}src${file.separator}main${file.separator}javascript

jsTestSrcDir:

Directory storing your Jasmine Specs.
  • Type: java.io.File
  • Since: 1.1.0
  • Required: No
  • User Property: jsTestSrcDir
  • Default: ${project.basedir}${file.separator}src${file.separator}test${file.separator}javascript

keepServerAlive:

Keep the server alive after the jasmine:test goal exists. Useful if you need to run further analysis on your tests, like collecting code coverage.
  • Type: boolean
  • Since: 1.3.1.0
  • Required: No
  • User Property: keepServerAlive
  • Default: false

manualSpecRunnerHtmlFileName:

The name of the Manual Spec Runner.
  • Type: java.lang.String
  • Since: 1.1.0
  • Required: No
  • Default: ManualSpecRunner.html

mvnTestSkip:

Skip compilation and execution of tests.
  • Type: boolean
  • Since: 1.3.1.3
  • Required: No
  • User Property: maven.test.skip

phantomjs:

Configure which version of PhantomJS should be used and how it should be found. The core of the phantomjs-maven-plugin is used to provide this functionality and this parameter should match the configuration of the phantomjs-maven-plugin install goal.


Default Options:

<phantomjs>
  <version>2.0.0</version>
  <checkSystemPath>true</checkSystemPath>
  <enforceVersion>true</enforceVersion>
  <source>REPOSITORY</source>
  <baseUrl></baseUrl>
  <outputDirectory>target/phantomjs</outputDirectory>
</phantomjs>
  • Type: com.github.searls.jasmine.mojo.PhantomJsOptions
  • Since: 2.0
  • Required: No
  • User Property: phantomjs
  • Default: ${phantomJs}

preloadSources:

JavaScript sources (typically vendor/lib dependencies) that need to be loaded before other sources (and specs) in a particular order. Each source will first be searched for relative to ${jsSrcDir}, then ${jsTestSrcDir}, then (if it's not found in either) it will be included exactly as it appears in your POM.


Therefore, if jquery.js is in ${jsSrcDir}/vendor, you would configure:

<preloadSources>
  <source>vendor/jquery.js</source>
</preloadSources>

And jquery.js would load before all the other sources and specs.

  • Type: java.util.List
  • Since: 1.1.0
  • Required: No

reporters:

Specify a custom reporter to be used to print the test report.

Example usage:

<reporters>
  <reporter>
    <reporterName>${project.basedir}/src/test/resources/myCustomReporter.js</reporterName>
  </reporter>
  <reporter>
    <reporterName>STANDARD</reporterName>
  </reporter>
</reporters>
  • Type: java.util.List
  • Required: No

serverHostname:

Not used by the jasmine:bdd goal.


The jasmine:test goal to specify hostname where the server is running. Useful when using the RemoteWebDriver.

  • Type: java.lang.String
  • Since: 1.3.1.4
  • Required: No
  • User Property: jasmine.serverHostname
  • Default: localhost

serverPort:

Used by the jasmine:bdd goal to specify port to run the server under.


The jasmine:test goal always uses a random available port so this property is ignored.

  • Type: int
  • Since: 1.1.0
  • Required: No
  • User Property: jasmine.serverPort
  • Default: 8234

skipJasmineTests:

Skip only jasmine tests
  • Type: boolean
  • Since: 1.3.1.3
  • Required: No
  • User Property: skipJasmineTests

skipTests:

Skip execution of tests.
  • Type: boolean
  • Since: 1.1.0
  • Required: No
  • User Property: skipTests

sourceEncoding:

The source encoding.
  • Type: java.lang.String
  • Since: 1.1.0
  • Required: No
  • Default: ${project.build.sourceEncoding}

sourceExcludes:

Just like sourceIncludes, but will exclude anything matching the provided patterns.

There are no sourceExcludes by default.

  • Type: java.util.List
  • Since: 1.1.0
  • Required: No

sourceIncludes:

Allows specifying which source files should be included and in what order.

<sourceIncludes>
  <include>vendor/**/*.js</include>
  <include>myBootstrapFile.js</include>
  <include>**/*.js</include>
  <include>**/*.coffee</include>
</sourceIncludes>

Default sourceIncludes:

<sourceIncludes>
  <include>**/*.js</include>
  <include>**/*.coffee</include>
</sourceIncludes>
  • Type: java.util.List
  • Since: 1.1.0
  • Required: No

specDirectoryName:

The name of the directory the specs will be deployed to on the server.
  • Type: java.lang.String
  • Since: 1.1.0
  • Required: No
  • Default: spec

specExcludes:

Just like specIncludes, but will exclude anything matching the provided patterns.

There are no specExcludes by default.

  • Type: java.util.List
  • Since: 1.1.0
  • Required: No

specIncludes:

I often find myself needing control of the spec include order when I have some global spec helpers or spec-scoped dependencies, like:

<specIncludes>
  <include>jasmine-jquery.js</include>
  <include>spec-helper.js</include>
  <include>**/*.js</include>
  <include>**/*.coffee</include>
</specIncludes>

Default specIncludes:

<specIncludes>
  <include>**/*.js</include>
  <include>**/*.coffee</include>
</specIncludes>
  • Type: java.util.List
  • Since: 1.1.0
  • Required: No

specRunnerHtmlFileName:

The name of the Spec Runner file.
  • Type: java.lang.String
  • Since: 1.1.0
  • Required: No
  • Default: SpecRunner.html

specRunnerTemplate:

Determines the strategy to use when generation the JasmineSpecRunner. This feature allows for custom implementation of the runner generator. Typically this is used when using different script runners.


Some valid examples: DEFAULT, REQUIRE_JS

  • Type: com.github.searls.jasmine.runner.SpecRunnerTemplate
  • Since: 1.1.0
  • Required: No
  • User Property: jasmine.specRunnerTemplate
  • Default: DEFAULT

srcDirectoryName:

The name of the directory the sources will be deployed to on the server.
  • Type: java.lang.String
  • Since: 1.1.0
  • Required: No
  • Default: src

timeout:

Timeout for spec execution in seconds.
  • Type: int
  • Since: 1.1.0
  • Required: No
  • Default: 300

uriScheme:

Specify the URI scheme in which to access the SpecRunner.

  • Type: java.lang.String
  • Since: 1.3.1.4
  • Required: No
  • User Property: jasmine.uriScheme
  • Default: http

webDriverCapabilities:

Web driver capabilities used to initialize a DesiredCapabilities instance when creating a web driver.


Capabilities value can be either a String, a List, or a Map.


Example:

<webDriverCapabilities>
  <capability>
    <name>phantomjs.binary.path</name>
    <value>/opt/phantomjs/bin/phantomjs</value>
  </capability>
  <capability>
    <name>phantomjs.cli.args</name>
    <list>
      <value>--disk-cache=true</value>
      <value>--max-disk-cache-size=256</value>
    </list>
  </capability>
  <capability>
    <name>proxy</name>
    <map>
      <httpProxy>myproxyserver.com:8000</httpProxy>
    </map>
  </capability>
</webDriverCapabilities>
  • Type: java.util.List
  • Since: 1.3.1.1
  • Required: No

webDriverClassName:

Determines the Selenium WebDriver class we'll use to execute the tests. See the Selenium documentation for more details. The plugin uses PhantomJSDriver by default.

Some valid examples:

  • org.openqa.selenium.htmlunit.HtmlUnitDriver
  • org.openqa.selenium.phantomjs.PhantomJSDriver
  • org.openqa.selenium.firefox.FirefoxDriver
  • org.openqa.selenium.ie.InternetExplorerDriver

See the webDriverCapabilities property for configuring driver specific properties.
  • Type: java.lang.String
  • Since: 1.1.0
  • Required: No
  • Default: org.openqa.selenium.phantomjs.PhantomJSDriver