【Groovy】Spock with Maven
已经在项目里使用Groovy/Spock做测试框架了,感觉和Maven结合在一起还是挺好用的。
在Maven的pom.xml里引入他们还是挺方便的,第一先要在dependency 里引入
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.8.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>0.6-groovy-1.8</version>
<scope>test</scope>
</dependency>
接着是要在Plugin部分做些配置
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<configuration>
<tasks>
<taskdef classname="org.codehaus.groovy.ant.Groovyc" name="groovyc">
<classpath refid="maven.test.classpath"/>
</taskdef>
<mkdir dir="${project.build.outputDirectory}"/>
<mkdir dir="${project.build.testOutputDirectory}"/>
<groovyc destdir="${project.build.testOutputDirectory}" listfiles="true" srcdir="${basedir}">
<classpath refid="maven.test.classpath"/>
</groovyc> <ant antfile="${basedir}/build.xml" target="groovytarget"> </ant>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>1.6.5</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.spockframework</groupId>
<artifactId>spock-maven</artifactId>
<version>0.6-groovy-1.8</version>
<executions>
<execution>
<goals>
<goal>find-specs</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.3</version>
<executions> <execution>
<goals>
<!--
<goal>generateStubs</goal>
<goal>compile</goal>
-->
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals> <configuration>
<debug>true</debug>
<verbose>true</verbose>
<stacktrace>true</stacktrace>
<defaultScriptExtension>.groovy</defaultScriptExtension>
<providerSelection>1.7</providerSelection>
<source>
<fileset>
<directory>${pom.dir}</directory>
<includes>
<include>**/groovy/*.groovy</include>
</includes>
</fileset> </source>
</configuration>
</execution> </executions>
</plugin>
</plugins>
</build>
【Groovy】Spock with Maven的更多相关文章
- 【Tool】IDEA配置Maven依赖管理
IDEA配置Maven 打开IDEA,在项目界面打开[File] — [Settings] 找到构建工具,下面第一个就是Maven 主选项更换我们自己的主目录和设置目录与本地仓库 勾选[打印异常捕获信 ...
- 【Tool】Windows系统安装Maven依赖管理工具
安装Maven依赖管理工具 官网下载地址:http://maven.apache.org/download.cgi 系统环境要求: [JDK]Maven3.3版本+需要JDK1.7版本以上支持 [内存 ...
- Groovy(java)+Spock+IDEA+maven+Jenkins+SVN+maven-surefire-plugin+maven-surefire-report-plugin/maven-antrun-extended-plugin集成接口测试框架
文章为原创,未经本人授权禁止转载. 一.spock框架环境搭建. 二.基于spock框架的脚本开发. 三.基于spock框架的用例执行并生成HTML报告. 四.集成jenkins生成HTML报告. 五 ...
- 【SSM】Eclipse使用Maven创建Web项目+整合SSM框架
自己接触ssm框架有一段时间了,从最早的接触新版ITOO项目的(SSM/H+Dobbu zk),再到自己近期来学习到的<淘淘商城>一个ssm框架的电商项目.用过,但是还真的没有自己搭建过, ...
- 【转】Myeclipse建立Maven项目
原文地址: http://b-l-east.iteye.com/blog/1246482 1. 使用Maven创建webapp工程----原因是使用Maven时一般需要遵循一定的目录结构,虽然也可以使 ...
- 【Jersey】IntelliJ IDEA + Maven + Jetty + Jersey搭建RESTful服务
本文参考以下内容: 使用Jersey实现RESTful风格的webservice(一) Starting out with Jersey & Apache Tomcat using Intel ...
- 【转】idea 用maven骨架生成项目速度慢的问题
转自:http://9leg.com/maven/2015/02/01/why-is-mvn-archetype-generate-so-low.html 最近从IntelliJ Idea 14的Co ...
- 【Groovy】入门布道ppt
Groovy Outline• Hello world• Smooth Java integration• Flat learning curve• Powerful features 跟 Java ...
- 【转载】如何用Maven创建web项目(具体步骤)
使用eclipse插件创建一个web project 首先创建一个Maven的Project如下图 我们勾选上Create a simple project (不使用骨架) 这里的Packing 选择 ...
随机推荐
- struts1-mapping.getInputForward()与mapping.getInput
转自:https://www.cnblogs.com/azai/archive/2010/06/05/1752416.html 奇怪为什么登陆失败的时候 没有错误提示.这个问题困扰了N久 仔细看了下, ...
- CentOS7:ifconfig command not found解决和netstat -an
没有 ifconfig 和netstat -an 的话安装 net-tools package yum install net-tools
- ubuntu16.04安装labelme
1.安装Anaconda 下载 官方下载地址:https://www.continuum.io/downloads 所有安装包地址:https://repo.continuum.io/archive/ ...
- 算法Sedgewick第四版-第1章基础-021一双向链表,在遍历时可修改、删除元素
package algorithms.ADT; /*************************************************************************** ...
- p4301 [CQOI2013]新Nim游戏
传送门 分析 通过nim游戏我们可以知道我们现在的任务就是通过两轮之后使得剩余的几堆异或和为非0数 所以我们只需要在第一步使得剩余集合的任意非空子集的异或和非0即可 于是我们考虑线性基 我们知道线性基 ...
- p2234&bzoj1588 营业额统计
传送门 题目 营业额统计 Tiger最近被公司升任为营业部经理,他上任后接受公司交给的第一项任务便是统计并分析公司成立以来的营业情况. Tiger拿出了公司的账本,账本上记录了公司成立以来每天的营业额 ...
- 100741A Queries
传送门 题目 Mathematicians are interesting (sometimes, I would say, even crazy) people. For example, my f ...
- Jsp入门第二天
1. JSP 指令: JSP指令(directive)是为JSP引擎而设计的. 它们并不直接产生任何可见输出, 而只是告诉引擎如何处理JSP页面中的其余部分. 2. 在目前的JSP 2.0中,定义了p ...
- [学习笔记]通过open函数改变标准输出的方法
int main(void) { char s[] = "abc.txt"; ; close(STDOUT_FILENO);//关闭标准输出文件描述符 int fd1 = open ...
- 答C++复杂多余者之惑
C和C++有太多的历史包袱而其它语言并没有这些,从另一个角度下来讲C和C++其实就是现代语言的活字典,也是现代软件设计的基础,当然有更古老的语言,但像C和C++影响力这么大的却无其它语言可以出其左右. ...