...
Code Block | ||
---|---|---|
| ||
<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, default is 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> |
...
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
The following code block shows an example of how your GreenPepper Core's pom.xml could look like.
Code Block | ||
---|---|---|
| ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>greenpepper-core</artifactId>
<packaging>jar</packaging>
<name>${project.subproject.title}</name>
<parent>
<groupId>com.greenpepper</groupId>
<artifactId>greenpepper</artifactId>
<version>3.1.2</version>
</parent>
<build>
<resources>
<resource>
<directory>src/main/filter</directory>
<filtering>true</filtering>
<targetPath>../filtered-sources</targetPath>
<includes>
<include>**/*.java</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>com.greenpepper</groupId>
<artifactId>greenpepper-maven-plugin</artifactId>
<version>${greenpepper.maven.plugin.version}</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<fixtureSourceDirectory>src/fixture/java</fixtureSourceDirectory>
<fixtureOutputDirectory>target/fixture-test-classes</fixtureOutputDirectory>
<specsDirectory>src/specs</specsDirectory>
<reportsDirectory>target/greenpepper-reports</reportsDirectory>
<reportsType>xml</reportsType>
<systemUnderDevelopment>com.greenpepper.systemunderdevelopment.GreenPepperSystemUnderDevelopment</systemUnderDevelopment>
<resources>
<resource>
<directory>src/fixture/resources</directory>
</resource>
</resources>
<repositories>
<repository>
<name>Seeds</name>
<type>com.greenpepper.repository.FileSystemRepository</type>
<root>${basedir}/src/fixture/specs</root>
<suites>
<suite>Seeds</suite>
</suites>
</repository>
</repositories>
<goalPrefix>greenpepper</goalPrefix>
</configuration>
<executions>
<execution>
<id>greenpepper</id>
<goals>
<goal>compile</goal>
<goal>resources</goal>
<goal>fixture-jar</goal>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> |
File System Repository
In the following example, the specifications will be saved in ${basedir}/src/fixture/specs, as specified in the root element. The first repository will save its specifications in a subdirectory called Demo, the second one in a subdirectory called DemoPhoneBook.
Code Block | ||
---|---|---|
| ||
<repositories>
<repository>
<name>Demo</name>
<type>com.greenpepper.repository.FileSystemRepository</type>
<root>${basedir}/src/fixture/specs</root>
<suites>
<suite>Demo</suite>
</suites>
</repository>
<repository>
<name>DemoPhoneBook</name>
<type>com.greenpepper.repository.FileSystemRepository</type>
<root>${basedir}/src/fixture/specs</root>
<suites>
<suite>DemoPhoneBook</suite>
</suites>
</repository>
</repositories> |
Command line options
Skip execution of the GreenPepper tests
Code Block -Dmaven.greenpepper.test.skip=true
Change the report type (default is HTML)
Code Block -Dmaven.greenpepper.reports.type=xml
Stop execution on first failed test
Code Block -Dmaven.greenpepper.test.stop=true
Activate debug mode
Code Block -Dmaven.greenpepper.debug=true
Ignore failed tests during execution (won't cause Maven to stop execution with an error message)
Code Block -Dmaven.greenpepper.test.failure.ignore=true
Sonar
Sonar, also known as SonarQube, is an open platform that aims at managing the quality of your code. The Sonar GreenPepper Plugin feeds Sonar with the test reports provided by the GreenPepper Maven Plugin.
The easiest way to produce a Sonar report using GreenPepper test reports is the following:
Code Block |
---|
mvn clean integration-test sonar:sonar |
The integration-test will trigger the following goals:
- greenpepper:compile
- greenpepper:resources
- greenpepper:fixture-jar
- greenpepper:run
Please note that in order to use the Sonar GreenPepper Plugin, the GreenPepper reports need to have XML file format which can be achieved by doing either of the following:
Add the reportsType tag to the plugin configuration in your project's pom.xml
Code Block <reportsType>xml</reportsType>
Add a reports type specification to the command line
Code Block -Dmaven.greenpepper.reports.type=xml
Runner