让 gradle 和 cucumber 工作?
问题说明
让 gradle 干净地使用 cucumber 是一个挑战.我想让 gradle build
来编译和运行测试,但到目前为止我还没有成功.
Getting gradle to work with cucumber cleanly is something of a challenge. I want to get gradle build
to compile and run the tests, but so far I've had no success.
plugins {
id "com.github.samueltbrown.cucumber" version "0.9"
}
apply plugin: 'java'
apply plugin: 'idea'
def JAVA_WEBSOCKET_VERSION = '1.2.1'
def CUCUMBER_VERSION = '1.2.4'
jar {
manifest {
attributes 'Implementation-Title': 'Java-WebSocket',
'Implementation-Version': JAVA_WEBSOCKET_VERSION
}
}
repositories {
jcenter()
}
dependencies {
testCompile "info.cukes:cucumber-java:$CUCUMBER_VERSION"
testCompile "info.cukes:cucumber-junit:$CUCUMBER_VERSION"
testCompile 'junit:junit:4. '
}
task wrapper(type: Wrapper) {
gradleVersion = '2.9'
}
目前我收到很多关于黄瓜使用的注释(@Given
、@Then
、@After
)的错误.我想要的是在不使用 JavaExec 的情况下干净地构建项目.这是可能的,还是对 gradle 或 cucumber 有特定的限制来防止这种情况发生?
Currently I get many errors about the annotations (@Given
, @Then
, @After
) that cucumber uses. What I want is to build the project cleanly without using JavaExec. Is this possible or is there a specific limitation to either gradle or cucumber that prevents this?
正确答案
dependencies {
testCompile 'info.cukes:cucumber-jvm:1 '
testCompile 'info.cukes:cucumber-jvm-deps:1 '
testCompile 'info.cukes:cucumber-java:1 '
testCompile 'info.cukes:cucumber-junit:1 '
testCompile 'info.cukes:cucumber-core:1 '
}
我创建了另一个函数来执行测试
I created another function to execute test
test {
ignoreFailures = true
// show standard out and standard error of the test JVM(s) on the console
testLogging.showStandardStreams = true
// set heap size for the test JVM(s)
minHeapSize = "128m"
maxHeapSize = "512m"
// set JVM arguments for the test JVM(s)
jvmArgs '-XX:MaxPermSize=256m'
// listen to events in the test execution lifecycle
beforeTest { descriptor ->
logger.lifecycle("Running test: " descriptor)
}
// explicitly include or exclude tests( Add Package directly)
exclude "com/**/***/rest/junit**"
exclude "com/**/***/db/junit**"
reports.junitXml.enabled = false
reports.html.enabled = false
}
现在从命令行调用这个函数来执行测试
now Call this function from command line for test execution
task "forceTest" {
dependsOn "clean", "cleanTest", "test"
}
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tangcbjfb
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20