Gradle:如何排除一些测试? [英] Gradle: how to exclude some tests?

查看:404
本文介绍了Gradle:如何排除一些测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 src / test / 文件夹包含单元测试和功能测试。功能测试的类路径包含单词 cucumber ,而单元测试不包含。那么,我怎样才能运行单元测试?



非常感谢。



P。:我知道使用包含逻辑很容易选择测试。例如,为了在我的情况下只运行功能测试,我可以简单地使用这个

./ gradlew test -Dtest.single = cucumber / ** /

但是,我不知道如何以简单的方式排除测试。

顺便说一句,我正在使用gradle 1.11。

解决方案

该任务的文档解释它,并举例说明所有内容:

  apply plugin:'java'// added'test'task 

test {
// ...

//明确包含或排除测试
include'org / foo / **'
exclude'org / boo / **'

// ...
}


My src/test/ folder includes both unit and functional tests. The classpath of functional tests has the word cucumber, whereas the unit tests do not. So, how can I run the unit tests only?

Thank you very much.

P.S.: I know it is easy to use the "include" logic to select tests. For example, to only run the functional tests in my case, I can simply use this
./gradlew test -Dtest.single=cucumber/**/
However, I don't know how to exclude tests in a simple way.

BTW, I am using gradle 1.11.

解决方案

The documentation of the task explains it, with an example and everything:

apply plugin: 'java' // adds 'test' task

test {
  // ...

  // explicitly include or exclude tests
  include 'org/foo/**'
  exclude 'org/boo/**'

  // ...
}

这篇关于Gradle:如何排除一些测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆