public abstract class AbstractJasmineMojo extends org.apache.maven.plugin.AbstractMojo implements JasmineConfiguration
| Modifier and Type | Field and Description |
|---|---|
protected int |
autoRefreshInterval
Automatically refresh the test runner at the given interval (specified in seconds) when using the
jasmine:bdd goal. |
protected String |
browserVersion
Determines the browser and version profile that HtmlUnit will simulate.
|
protected boolean |
coffeeScriptCompilationEnabled
Control the Coffee Script compilation.
|
protected String |
connectorClass
Type of
Connector to use on the jetty server. |
protected String |
customRunnerConfiguration
Sometimes you want to have full control over how scriptloaders are configured.
|
protected String |
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.
|
protected boolean |
debug
True to increase HtmlUnit output and attempt reporting on specs even if a timeout occurred.
|
protected String |
format
Determines the format that jasmine:test will print to console.
|
protected boolean |
haltOnFailure
Halt the build on test failure.
|
protected File |
jasmineTargetDir
Target directory for files created by the plugin.
|
protected String |
junitXmlReportFileName
The name of the generated JUnit XML report.
|
protected boolean |
keepServerAlive
Keep the server alive after the
jasmine:test goal exists. |
protected org.codehaus.plexus.resource.ResourceManager |
locator |
protected String |
manualSpecRunnerHtmlFileName
The name of the Manual Spec Runner.
|
protected org.apache.maven.project.MavenProject |
mavenProject |
protected boolean |
mvnTestSkip
Skip compilation and execution of tests.
|
protected List<String> |
preloadSources
JavaScript sources (typically vendor/lib dependencies) that need to be loaded
before other sources (and specs) in a particular order.
|
protected String |
scriptLoaderPath
Deprecated.
Specify script loader path using the
preloadSources parameter instead. |
protected String |
serverHostname
Not used by the
jasmine:bdd goal. |
protected int |
serverPort
Used by the
jasmine:bdd goal to specify port to run the server under. |
protected boolean |
skipJasmineTests
Skip only jasmine tests
|
protected boolean |
skipTests
Skip execution of tests.
|
protected String |
sourceEncoding
The source encoding.
|
protected ScriptSearch |
sources |
protected String |
specDirectoryName
The name of the directory the specs will be deployed to on the server.
|
protected String |
specRunnerHtmlFileName
The name of the Spec Runner file.
|
protected SpecRunnerTemplate |
specRunnerTemplate
Determines the strategy to use when generation the JasmineSpecRunner.
|
protected ScriptSearch |
specs |
protected String |
srcDirectoryName
The name of the directory the sources will be deployed to on the server.
|
protected StringifiesStackTraces |
stringifiesStackTraces |
protected int |
timeout
Timeout for spec execution in seconds.
|
protected String |
uriScheme
Specify the URI scheme in which to access the SpecRunner.
|
protected List<Capability> |
webDriverCapabilities
Web driver capabilities used to initialize a DesiredCapabilities instance when creating a web driver.
|
protected String |
webDriverClassName
Determines the Selenium WebDriver class we'll use to execute the tests.
|
| Constructor and Description |
|---|
AbstractJasmineMojo() |
| Modifier and Type | Method and Description |
|---|---|
void |
execute() |
int |
getAutoRefreshInterval() |
File |
getBasedir() |
protected org.eclipse.jetty.server.Connector |
getConnector() |
List<Context> |
getContexts() |
File |
getCustomRunnerConfiguration() |
File |
getCustomRunnerTemplate() |
File |
getJasmineTargetDir() |
org.apache.maven.project.MavenProject |
getMavenProject() |
List<String> |
getPreloadSources() |
ClassLoader |
getProjectClassLoader() |
String |
getScriptLoaderPath()
Deprecated.
|
String |
getSourceEncoding() |
ScriptSearch |
getSources() |
String |
getSpecDirectoryName() |
SpecRunnerTemplate |
getSpecRunnerTemplate() |
ScriptSearch |
getSpecs() |
String |
getSrcDirectoryName() |
boolean |
isCoffeeScriptCompilationEnabled() |
protected boolean |
isSkipTests() |
abstract void |
run() |
getLog, getPluginContext, setLog, setPluginContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLog@Parameter(defaultValue="org.openqa.selenium.htmlunit.HtmlUnitDriver") protected String webDriverClassName
Some valid examples:
@Parameter protected List<Capability> 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>
@Parameter(defaultValue="FIREFOX_17") protected String browserVersion
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
@Parameter(defaultValue="documentation") protected String format
Determines the format that jasmine:test will print to console.
Valid options:
@Parameter protected List<String> 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.
@Parameter protected String 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>
@Parameter protected String 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>
@Parameter(defaultValue="${project.build.directory}${file.separator}jasmine")
protected File jasmineTargetDir
@Parameter(property="skipTests") protected boolean skipTests
@Parameter(property="maven.test.skip") protected boolean mvnTestSkip
@Parameter(property="skipJasmineTests") protected boolean skipJasmineTests
@Parameter(property="haltOnFailure",
defaultValue="true")
protected boolean haltOnFailure
@Parameter(defaultValue="300") protected int timeout
@Parameter(defaultValue="false") protected boolean debug
@Parameter(defaultValue="SpecRunner.html") protected String specRunnerHtmlFileName
@Parameter(defaultValue="ManualSpecRunner.html") protected String manualSpecRunnerHtmlFileName
@Parameter(defaultValue="TEST-jasmine.xml") protected String junitXmlReportFileName
@Parameter(defaultValue="spec") protected String specDirectoryName
@Parameter(defaultValue="src") protected String srcDirectoryName
@Parameter(defaultValue="${project.build.sourceEncoding}")
protected String sourceEncoding
@Parameter(property="keepServerAlive",
defaultValue="false")
protected boolean keepServerAlive
jasmine:test goal exists.
Useful if you need to run further analysis on your tests, like collecting code coverage.@Parameter(property="jasmine.serverPort",
defaultValue="8234")
protected int 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.
@Parameter(property="jasmine.uriScheme",
defaultValue="http")
protected String uriScheme
Specify the URI scheme in which to access the SpecRunner.
@Parameter(property="jasmine.serverHostname",
defaultValue="localhost")
protected String 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.
@Parameter(property="jasmine.specRunnerTemplate",
defaultValue="DEFAULT")
protected SpecRunnerTemplate 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
@Parameter @Deprecated protected String scriptLoaderPath
preloadSources parameter instead.Path to loader script, relative to jsSrcDir. Defaults to jsSrcDir/nameOfScript.js. Which script to look for is determined by the selected spcRunnerTemplate. I.e require.js is used when REQUIRE_JS is selected as specRunnerTemplate.
@Parameter(property="jasmine.autoRefreshInterval",
defaultValue="0")
protected int 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).
@Parameter(property="coffeeScriptCompilationEnabled",
defaultValue="true")
protected boolean 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.
@Parameter(property="jasmine.connectorClass",
defaultValue="org.eclipse.jetty.server.nio.SelectChannelConnector")
protected String 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.
@Parameter(defaultValue="${project}",
readonly=true)
protected org.apache.maven.project.MavenProject mavenProject
@Component protected org.codehaus.plexus.resource.ResourceManager locator
protected ScriptSearch sources
protected ScriptSearch specs
protected StringifiesStackTraces stringifiesStackTraces
public void execute()
throws org.apache.maven.plugin.MojoExecutionException,
org.apache.maven.plugin.MojoFailureException
execute in interface org.apache.maven.plugin.Mojoorg.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureExceptionpublic String getSourceEncoding()
getSourceEncoding in interface JasmineConfigurationpublic File getCustomRunnerTemplate()
getCustomRunnerTemplate in interface JasmineConfigurationpublic SpecRunnerTemplate getSpecRunnerTemplate()
getSpecRunnerTemplate in interface JasmineConfigurationpublic File getJasmineTargetDir()
getJasmineTargetDir in interface JasmineConfigurationpublic String getSrcDirectoryName()
getSrcDirectoryName in interface JasmineConfigurationpublic ScriptSearch getSources()
getSources in interface JasmineConfigurationpublic ScriptSearch getSpecs()
getSpecs in interface JasmineConfigurationpublic String getSpecDirectoryName()
getSpecDirectoryName in interface JasmineConfigurationpublic List<String> getPreloadSources()
getPreloadSources in interface JasmineConfigurationpublic int getAutoRefreshInterval()
getAutoRefreshInterval in interface JasmineConfigurationpublic boolean isCoffeeScriptCompilationEnabled()
isCoffeeScriptCompilationEnabled in interface JasmineConfigurationpublic org.apache.maven.project.MavenProject getMavenProject()
public File getCustomRunnerConfiguration()
getCustomRunnerConfiguration in interface JasmineConfiguration@Deprecated public String getScriptLoaderPath()
getScriptLoaderPath in interface JasmineConfigurationpublic File getBasedir()
getBasedir in interface JasmineConfigurationpublic ClassLoader getProjectClassLoader()
getProjectClassLoader in interface JasmineConfigurationpublic List<Context> getContexts()
getContexts in interface JasmineConfigurationprotected org.eclipse.jetty.server.Connector getConnector()
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprotected boolean isSkipTests()
Copyright © 2015. All rights reserved.