Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
<plugin>
	<groupId>com.greenpepper</groupId>
	<artifactId>greenpepper-maven-plugin</artifactId>
	<version><!-- your version of the GreenPepper Maven Plugin --></version>
	<configuration>
	    <source><!-- your source version --></source>
	    <target><!-- your target version --></target>
	    <fixtureSourceDirectory><!-- source directory of your fixtures, for example: src/fixture/java --></fixtureSourceDirectory>
	    <fixtureOutputDirectory><!-- output directory of the compiled fixture classes, for example: target/fixture-test-classes --></fixtureOutputDirectory>
	    <specsDirectory><!-- destination for downloaded specification files, for example: src/sprecs--></specsDirectory>
		<reportsDirectory><!-- destination for generated HTML reports, for example: target/greenpepper-reports</reportsDirectory>
		<reportsType><!-- the file format of your reports (XML or HTML) --></reportsType>
	    <resources>
	        <resource>
	            <directory><! -- directory for a specific resource. Example: src/fixture/resources--></directory>
	            <excludes>
	                <exclude>**/*.java</exclude>
	            </excludes>
	        </resource>
	    </resources>
	    <repositories>
	        <repository>
		        <type><!-- fully qualified name of your suit resolver class, for instance: com.greenpepper.repository.FileSystemRepository --></type>
				<root><!-- root directory of the current repository. Example: ${basedir}/src/fixture/specs --></root>
		        <suites>
		        	<suite><!-- the suit's URI --></suite>
		        </suites>
	        </repository>
	        <repository>
	            <type><!-- fully qualified name of your test resolver. --></type>
	            <tests>
	            	<test><!-- the test's URI --></test>
	            </tests>
	        </repository>
	    </repositories>
		<goalPrefix><!-- the prefix that will be associated with the plugin (optional, see below "Using the GreenPepper Maven Plugin"), eg: greenpepper --></goalPrefix>
	</configuration>
</plugin>

...

Generally, the goals of the GreenPepper Maven Plugin correspond to the phases of the default Maven lifecycle Build Lifecycle (with exception of the Freeze goal). Therefore, in order to interact with our fixture sources, we only have to tell Maven until which goal it should run.
NOTE: In order to use a prefix as we do below, it might be necessary to define the goalPrefix tag within the plugin configuration (see the code box above).
 

  • Compile fixture sources

    Code Block
    mvn greenpepper:compile
  • Copy resources to the destination directory

    Code Block
    mvn greenpepper:resources
  • Execute specifications

    Code Block
    mvn greenpepper:run
  • Create fixture jars

    Code Block
    mvn greenpepper:fixture-jar
  • Download specification files

    Code Block
    mvn greenpepper:freeze



Goals

Now that we know which goals exist for the GreenPepper Maven Plugin, let's have a closer look at each of them.

greenpepper:compile 


Compiles the fixtures of an application.

Mojo attributes:

  • Requires a Maven 2.0 project (or higher) to

...

 

 

...

  • execute
  • Dependency resolution of artifacts in scope required: test
  • Automatically executed within the Pre-Integration Test phase

Required parameters 

NameTypeDescription
fixtureSourceDirectoryFileSource directory containing the fixture classes to be compiled.
fixtureOutputDirectoryFileOutput directory in which the compiled sources are placed.


Optional parameters

The optional parameters are exactly the same as in the Maven Compiler Plugin.
 

Parameter details

Note that the values of the expressions given below are merely default values, so their use is not mandatory. 

  • fixtureSourceDirectory: Source directory containing the fixture classes to be compiled

    • Type: java.io.File
    • Expression (example): src/fixture/java

  • fixtureOutputDirectory: Output directory in which the compiled sources are placed.

    • Type: java.io.File
    • Expression: ${project.build.directory}/fixture-test-classes

greenpepper:resources 


Copies resources for the main source code to the main output directory.

Mojo attributes:

  • Requires a Maven 2.0 project (or higher) to execute
  • Automatically executed within the Pre-Integration Test phase

Required parameters 

NameTypeDescription
resourcesListList of resources to be copied to the output directory.
fixtureOutputDirectoryFileOutput directory the resources are copied to.


Optional parameters

The optional parameters resemble those for the Maven 2 resources plugin.
 

Parameter details

Note that the values of the expressions given below are merely default values, so their use is not mandatory. 

  • resources: List of resources to be copied to the output directory.

    • Type: java.util.List
    • Expression: none
       
  • fixtureOutputDirectory: Output directory the resources are copied to.

    • Type: java.io.File
    • Expression: ${project.build.directory}/fixture-test-classes

greenpepper:run 


Executes GreenPepper specifications.

Mojo attributes:

  • Requires a Maven 2.0 project (or higher) to execute
  • Dependency resolution of artifacts in scope required: test
  • Automatically executed within the Integration Test phase

Required parameters 

NameTypeDescription
basedirFileBase directory of the project under test (can be obtained in the unit tests using System.getProperty("basedir"))
classesDirectoryFileContains the generated classes of the project under test.
fixtureOutputDirectoryFileContains generated fixture classes of the project under test.
repositoriesRepositorysuite or test URI of specifications to test.
reportsDirectoryFileOutput directory for generated reports.
stopOnFirstFailureBooleanStops the specification's execution on the first failure if set to true.
testFailureIgnoreBooleanIgnores test failures if set to true. Although this is not recommended, there are several occasions where it might come in handy.


Optional parameters

None.
 

Parameter details

Note that the values of the expressions given below are merely default values, so their use is not mandatory. 

  • basedir: Base directory of the project under test.

    • Type: java.io.File
    • Expression: ${basedir}

  • classesDirectory: Contains the generated classes of the project under test.

    • Type: java.io.File
    • Expression: ${project.build.outputDirectory}

  • fixtureOutputDirectory: Contains generated fixture classes of the project under test.
    • Type: java.io.File
    • Expression: ${project.build.directory}/fixture-test-classes

  • reportsDirectory: Output directory for generated reports.
    • Type: java.io.File
    • Expression: ${project.build.directory}/greenpepper-reports

 

greenpepper:fixture-jar


Builds the fixture jars.

Mojo attributes:

  • Requires a Maven 2.0 project (or higher) to execute
  • Dependency resolution of artifacts in scope required: test
  • Automatically executed within the Post-Integration Test phase

Required parameters 

NameTypeDescription
fixtureOutputDirectoryFileDirectory containing the compiled fixture classes.


Optional parameters

None.
 

Parameter details

Note that the values of the expressions given below are merely default values, so their use is not mandatory. 
 

  • fixtureOutputDirectory: Directory containing the compiled fixture classes.

    • Type: java.io.File
    • Expression: ${project.build.directory}/fixture-test-classes


 

greenpepper:freeze


Downloads specification files from a remote repository and stores them locally.

Mojo attributes:

  • Requires a Maven 2.0 project (or higher) to execute
  • Dependency resolution of artifacts in scope required: test
  • Not bound to any phase of the default Maven Build Lifecycle

Required parameters 

NameTypeDescription
specsDirectoryFileDirectory the specification files are downloaded to.
repositoriesRepositorysuite or test URI of specifications to download.


Optional parameters

None.
 

Parameter details

Note that the values of the expressions given below are merely default values, so their use is not mandatory. 
 

  • specsDirectory: Destination directory for specifications to be downloaded. Specifications are stored in a subdirectory named after the given repository and optionally in a subdirectory named after the suite.

    • Type: java.io.File
    • Expression: ${basedir}/src/specs

 

 

Examples

 

GreenPepper Core pom.xml

 

Code Block