sak*_*das 17 android unit-testing gradle
Gradle具有测试配置块
https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html
```
apply plugin: 'java' // adds 'test' task
test {
// enable TestNG support (default is JUnit)
useTestNG()
// set a system property for the test JVM(s)
systemProperty 'some.prop', 'value'
// explicitly include or exclude tests
include 'org/foo/**'
exclude 'org/boo/**'
// 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)
}
// listen to standard out and standard error of the test JVM(s)
onOutput { descriptor, event ->
logger.lifecycle("Test: " + descriptor + " produced standard out/err: " + event.message )
}
}
Run Code Online (Sandbox Code Playgroud)
在哪里可以设置各种测试配置(我最感兴趣的是堆大小).Android项目有类似的东西吗?
R. *_*ski 16
有可能添加它们.Android Gradle插件有参数testOptions,它有参数unitTests,有选项all.
所以,如果你写:
android {
testOptions {
unitTests.all {
///apply test parameters
}
}
}
Run Code Online (Sandbox Code Playgroud)
测试将使用指定的参数执行.
| 归档时间: |
|
| 查看次数: |
2565 次 |
| 最近记录: |