Spring boot -Spock setup

2018-01-19  本文已影响0人  jiaozenghao

Spring boot 项目中添加Spock

Eclipse 需要安装groovy plugin
IDEA 自带groovy plugin

maven

Add dependency

 <!-- spock start -->
            <dependency>
                <groupId>org.spockframework</groupId>
                <artifactId>spock-spring</artifactId>
                <version>1.1-groovy-2.4</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-all</artifactId>
                <version>2.4.4</version>
                <scope>test</scope>
            </dependency>

            <!-- spock end -->


Plugin

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.18.1</version>
                <configuration>
                    <includes>
                        <include>**/*Test.java</include>
                        <include>**/*Spec.java</include>
                    </includes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.gmavenplus</groupId>
                <artifactId>gmavenplus-plugin</artifactId>
                <version>1.5</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>addTestSources</goal>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


上一篇下一篇

猜你喜欢

热点阅读