Sync docs from master to gh-pages
This commit is contained in:
@@ -3297,6 +3297,59 @@ or an environment variable.</simpara>
|
||||
</pluginManagement>
|
||||
</build></programlisting>
|
||||
</section>
|
||||
<section xml:id="_maven_plugin_with_spock_tests">
|
||||
<title>Maven Plugin with Spock Tests</title>
|
||||
<simpara>You can select the <link xl:href="http://spockframework.org/">Spock Framework</link> for creating and executing the auto-generated contract
|
||||
verification tests with both Maven and Gradle plugin. However, whereas with Gradle its really straightforward,
|
||||
in Maven you will require some additional setup in order to make the tests compile and execute properly.</simpara>
|
||||
<simpara>First of all, you will have to use a plugin, such as <link xl:href="https://github.com/groovy/GMavenPlus">GMavenPlus</link> plugin,
|
||||
to add Groovy to your project. In GMavenPlus plugin, you will need to explicitly set test sources, including both the
|
||||
path where your base test classes are defined and the path were the generated contract tests are added.
|
||||
Please refer to the example below:</simpara>
|
||||
<programlisting language="xml" linenumbering="unnumbered"><plugin>
|
||||
<groupId>org.codehaus.gmavenplus</groupId>
|
||||
<artifactId>gmavenplus-plugin</artifactId>
|
||||
<version>1.6.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>compileTests</goal>
|
||||
<goal>addTestSources</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<testSources>
|
||||
<testSource>
|
||||
<directory>${project.basedir}/src/test/groovy</directory>
|
||||
<includes>
|
||||
<include>**/*.groovy</include>
|
||||
</includes>
|
||||
</testSource>
|
||||
<testSource>
|
||||
<directory>
|
||||
${project.basedir}/target/generated-test-sources/contracts/com/example/beer
|
||||
</directory>
|
||||
<includes>
|
||||
<include>**/*.groovy</include>
|
||||
<include>**/*.gvy</include>
|
||||
</includes>
|
||||
</testSource>
|
||||
</testSources>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
<version>2.4.15</version>
|
||||
<scope>runtime</scope>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
</dependencies></programlisting>
|
||||
<simpara>If you uphold to the Spock convention of ending the test class names with <literal>Spec</literal>, you will also need to adjust your Maven
|
||||
Surefire plugin setup, like in the following example:</simpara>
|
||||
<programlisting language="xml" linenumbering="unnumbered"></programlisting>
|
||||
</section>
|
||||
</section>
|
||||
<section xml:id="_stubs_and_transitive_dependencies">
|
||||
<title>Stubs and Transitive Dependencies</title>
|
||||
|
||||
Reference in New Issue
Block a user