sip*_*ipi 8 android gradle jenkins android-testing build.gradle
嗨,我已经在Jenkins上设置了我的Android项目来提供CI.它运行良好,在连接的Android手机上运行测试.测试在Android测试框架上运行,扩展了jUnit3.
不幸的是,如果有任何测试失败,则构建被标记为失败.我希望能够通过两种方式改进这一点:
对于第1项,我尝试将其添加到项目build.gradle中:
connectedCheck {
ignoreFailures = true
}
Run Code Online (Sandbox Code Playgroud)
但它没有效果.查看构建日志,我意识到实际的测试任务名为connectedInstrumentTest,但未找到此任务:
connectedInstrumentTest {
ignoreFailures = true
}
Run Code Online (Sandbox Code Playgroud)
原因:
无法在项目':Playtime'上为参数[build_4ldpah0qgf0ukktofecsq41r98 $ _run_closure3 @ 9cd826]找到方法connectedInstrumentTest().
我错过了吗?
谢谢
编辑:继承我的项目build.gradle,没什么特别的:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
dependencies {
compile files('libs/android-support-v4.jar')
}
android {
compileSdkVersion 17
buildToolsVersion "18.0.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 16
testPackageName "com.bb.pt.test"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
}
connectedCheck {
ignoreFailures = true
}
Run Code Online (Sandbox Code Playgroud)
我在詹金斯的gradle设置:
switches: --stacktrace --info
tasks: :pt:assembleDebug :pt:assembleTest :pt:connectedCheck
Run Code Online (Sandbox Code Playgroud)
编辑:
我建立了gradlew并尝试了.相同的输出.如果测试失败,我不希望构建失败:
:pt:connectedInstrumentTest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':pt:connectedInstrumentTest'.
> There were failing tests. See the report at: file:///home/simon/WorkingCopies/bb/code/trunk/pt/pt/build/reports/instrumentTests/connected/index.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
BUILD FAILED
Run Code Online (Sandbox Code Playgroud)
我试图在build.gradle中限定任务名称:
task connectedCheck {
ignoreFailures = true
}
Run Code Online (Sandbox Code Playgroud)
但它认为我正在尝试添加新任务而不是修改现有任务.
FAILURE: Build failed with an exception.
* Where:
Build file '/home/simon/WorkingCopies/bb/code/trunk/pt/pt/build.gradle' line: 31
* What went wrong:
A problem occurred evaluating project ':pt'.
> Cannot add task ':pt:connectedCheck' as a task with that name already exists.
Run Code Online (Sandbox Code Playgroud)
cof*_*aks 11
在我们的谈话之后,我相信:
我相信(虽然我不是专家)你应该让connectedInstrumentTest忽略失败,但你尝试使用以下失败
connectedInstrumentTest {
ignoreFailures = true
}
Run Code Online (Sandbox Code Playgroud)也许解决方案是像这样包装这个配置节点:
project.gradle.taskGraph.whenReady {
connectedInstrumentTest {
ignoreFailures = true
}
}
Run Code Online (Sandbox Code Playgroud)https://github.com/stanfy/hotandroid/blob/master/part0/build.gradle
| 归档时间: |
|
| 查看次数: |
2944 次 |
| 最近记录: |