com.github.searls.jasmine
Class AbstractJasmineMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by com.github.searls.jasmine.AbstractJasmineMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
GenerateManualRunnerMojo, PreparePackageMojo, ProcessResourcesMojo, ProcessTestResourcesMojo, ServerMojo, TestMojo

public abstract class AbstractJasmineMojo
extends org.apache.maven.plugin.AbstractMojo


Field Summary
protected  String browserVersion
          Determines the browser and version profile that HtmlUnit will simulate.
protected  File customRunnerConfiguration
          Sometimes you want to have full control over how scriptloaders are configured.
protected  File 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
           
protected  File jasmineTargetDir
           
protected  String junitXmlReportFileName
           
protected  String manualSpecRunnerHtmlFileName
           
protected  org.apache.maven.project.MavenProject mavenProject
           
protected  File packageDir
           
protected  String packageJavaScriptPath
           
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
          Path to loader script, relative to jsSrcDir.
protected  int serverPort
           
protected  boolean skipTests
           
protected  String sourceEncoding
           
protected  ScriptSearch sources
           
protected  String specDirectoryName
           
protected  String specRunnerHtmlFileName
           
protected  String specRunnerTemplate
          Determines the strategy to use when generation the JasmineSpecRunner.
protected  ScriptSearch specs
           
protected  String srcDirectoryName
           
protected  StringifiesStackTraces stringifiesStackTraces
           
protected  int timeout
          Timeout for spec execution in seconds.
protected  String webDriverClassName
          Determines the Selenium WebDriver class we'll use to execute the tests.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractJasmineMojo()
           
 
Method Summary
 void execute()
           
 File getCustomRunnerConfiguration()
           
 File getCustomRunnerTemplate()
           
 File getJasmineTargetDir()
           
 org.apache.maven.project.MavenProject getMavenProject()
           
 List<String> getPreloadSources()
           
 String getScriptLoaderPath()
           
 String getSourceEncoding()
           
 ScriptSearch getSources()
           
 String getSpecDirectoryName()
           
 String getSpecRunnerTemplate()
           
 ScriptSearch getSpecs()
           
 String getSrcDirectoryName()
           
abstract  void run()
           
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

webDriverClassName

protected String webDriverClassName
Determines the Selenium WebDriver class we'll use to execute the tests. See the Selenium documentation for more details. The plugin uses HtmlUnit by default. Some valid examples: org.openqa.selenium.htmlunit.HtmlUnitDriver, org.openqa.selenium.firefox.FirefoxDriver, org.openqa.selenium.ie.InternetExplorerDriver


browserVersion

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: FIREFOX_3_6, INTERNET_EXPLORER_6, INTERNET_EXPLORER_7, INTERNET_EXPLORER_8


format

protected String 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...')


packageJavaScriptPath

protected String packageJavaScriptPath

preloadSources

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/z.js</source> </preloadSources> And z.js would load before all the other sources and specs.


customRunnerTemplate

protected File 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. 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>


customRunnerConfiguration

protected File 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. * Example usage: <customRunnerConfiguration>${project.basedir}/src/test/resources/myCustomConfig.txt</customRunnerConfiguration>


jasmineTargetDir

protected File jasmineTargetDir

skipTests

protected boolean skipTests

haltOnFailure

protected boolean haltOnFailure

timeout

protected int timeout
Timeout for spec execution in seconds.


debug

protected boolean debug
True to increase HtmlUnit output and attempt reporting on specs even if a timeout occurred.


packageDir

protected File packageDir

specRunnerHtmlFileName

protected String specRunnerHtmlFileName

manualSpecRunnerHtmlFileName

protected String manualSpecRunnerHtmlFileName

junitXmlReportFileName

protected String junitXmlReportFileName

specDirectoryName

protected String specDirectoryName

srcDirectoryName

protected String srcDirectoryName

sourceEncoding

protected String sourceEncoding

mavenProject

protected org.apache.maven.project.MavenProject mavenProject

serverPort

protected int serverPort

specRunnerTemplate

protected String 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: REQUIRE_JS


scriptLoaderPath

protected String scriptLoaderPath
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.


sources

protected ScriptSearch sources

specs

protected ScriptSearch specs

stringifiesStackTraces

protected StringifiesStackTraces stringifiesStackTraces
Constructor Detail

AbstractJasmineMojo

public AbstractJasmineMojo()
Method Detail

execute

public final void execute()
                   throws org.apache.maven.plugin.MojoExecutionException,
                          org.apache.maven.plugin.MojoFailureException
Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException

run

public abstract void run()
                  throws Exception
Throws:
Exception

getSourceEncoding

public String getSourceEncoding()

getCustomRunnerTemplate

public File getCustomRunnerTemplate()

getSpecRunnerTemplate

public String getSpecRunnerTemplate()

getJasmineTargetDir

public File getJasmineTargetDir()

getSrcDirectoryName

public String getSrcDirectoryName()

getSources

public ScriptSearch getSources()

getSpecs

public ScriptSearch getSpecs()

getSpecDirectoryName

public String getSpecDirectoryName()

getPreloadSources

public List<String> getPreloadSources()

getMavenProject

public org.apache.maven.project.MavenProject getMavenProject()

getCustomRunnerConfiguration

public File getCustomRunnerConfiguration()

getScriptLoaderPath

public String getScriptLoaderPath()


Copyright © 2012. All Rights Reserved.