GreenPepper Maven Plugin - Usage
Usage
The GreenPepper Plugin can be invoked by calling the integration-test
phase of the build lifecycle.
Install GreenPepper Maven plugin
The Maven plugin is available on Central. However if you are interested in the developpement versions, you may add our repository to your project Pom.xml
for automatic download and upgrade. See add repositories.
<repositories> <repository> <id>ossrh</id> <name>Sonatype Public Repository</name> <url>https://oss.sonatype.org/content/groups/public/</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>ossrh</id> <name>Sonatype Public Repository</name> <url>https://oss.sonatype.org/content/groups/public/</url> </pluginRepository> </pluginRepositories>
Configure GreenPepper Maven plugin
The GreenPepper Maven plugin is used during the Preintegration test phase of the build lifecycle to compile and copy the fixtures classes of an application. By default, it copies the classes to: ${project.build.directory}/fixture-test-classes/
The GreenPepper Maven plugin is then used during the Integration test phase of the build lifecycle to execute the specifications of an application. It generates reports in plain HTML file format (*.html). By default, these files are generated in: $basedir/target/greenpepper-reports/
.
The GreenPepper Maven plugin is used during the post-integration-test
phase of the build lifecycle to create the fixtures jar of an application. By default, it generates a jar in: $basedir/target/
.
Full Example Configuration
GreenPepper Core Pom.xml example
<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>GreenPepper Core</name> <parent> <groupId>com.github.strator-dev.greenpepper</groupId> <artifactId>greenpepper-open</artifactId> <version>${project.version}</version> </parent> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <executions> <execution> <goals> <goal>test-jar</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>com.github.strator-dev.greenpepper</groupId> <artifactId>greenpepper-maven-plugin</artifactId> <version>${project.version}</version> <configuration> <source>1.6</source> <target>1.6</target> <fixtureSourceDirectory>src/fixture/java</fixtureSourceDirectory> <fixtureOutputDirectory>target/fixture-test-classes</fixtureOutputDirectory> <specsDirectory>src/specs</specsDirectory> <reportsDirectory>target/greenpepper-reports</reportsDirectory> <systemUnderDevelopment>com.greenpepper.systemunderdevelopment.GreenPepperSystemUnderDevelopment</systemUnderDevelopment> <resources> <resource> <directory>src/fixture/resources</directory> </resource> </resources> <repositories> <repository> <type>com.greenpepper.runner.repository.GreenPepperRepository</type> <root> <![CDATA[http://www.greenpeppersoftware.com/confluence/rpc/xmlrpc?handler=greenpepper1&sut=GreenPepperOpen - Core Java&includeStyle=true]]> </root> <name>greenpepper</name> <suites> <suite>GreenPepper Confluence-GREENPEPPER</suite> </suites> </repository> </repositories> </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>
Example of a file system repository
In this example, the specifications are under the directory ${basedir}/src/fixture/specs
(which corresponds to the root element). For each repository, the specifications are under the directories Demo and DemoPhoneBook.
<build> <plugins> <plugin> <groupId>com.github.strator-dev.greenpepper</groupId> <artifactId>greenpepper-maven-plugin</artifactId> <version>${project.version}</version> <configuration> <source>1.6</source> <target>1.6</target> <fixtureSourceDirectory>src/fixture/java</fixtureSourceDirectory> <fixtureOutputDirectory>target/fixture-test-classes</fixtureOutputDirectory> <systemUnderDevelopment>com.greenpepper.confluence.demo.DemoSystemUnderDevelopment</systemUnderDevelopment> <resources> <resource> <directory>src/fixture/resources</directory> <excludes> <exclude>**/*.java</exclude> </excludes> </resource> </resources> <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> </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>
More example can be found on the examples page