我有一个简单的HelloWorld Android项目(内置于Eclipse IDE中),我可以在此项目的cmd提示符下成功执行“gradle build”。编写Gradle脚本为Eclipse运行单元测试用例Android测试项目
另外我也为它编写了一个简单的JUnit Android测试项目,并且它在Eclipse中运行良好。
现在我想运行这个测试项目或单元测试用例(如果我的理解是错误的!)使用Gradle脚本。 我该怎么做?
以下是我正在使用的build.gradle文件。我想知道如何编写脚本代码来自动执行测试用例。
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.10.+'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
test {
java.srcDirs = ['src/test/java']
resources.srcDirs = ['src/test/resources']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
androidTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
'instrumentTest'重命名为'androidTest',请参阅https://github.com/Nodeclipse/nodeclipse-1/blob/master/org.nodeclipse.enide的历史记录.editors.gradle /文档/安卓/编译。gradle –