Ich habe ein einfaches HelloWorld Android-Projekt (in Eclipse IDE gebaut), ich bin in der Lage, "Gradle Build" erfolgreich in cmd Prompt für dieses Projekt zu tun.Schreiben Gradle Skript zum Ausführen von Einheit Testfälle für Eclipse Android Test-Projekt
Auch ich habe ein einfaches JUnit Android Test-Projekt dafür geschrieben, und es läuft gut in Eclipse.
Jetzt möchte ich dieses Testprojekt oder Unit Test Cases (wenn mein Verständnis falsch ist!) Mit Gradle Skript ausführen. Wie mache ich das?
Folgendes ist die build.gradle-Datei, die ich verwende. Ich möchte wissen, wie man Skriptcode schreibt, um die Testfallausführung zu automatisieren.
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' wurde umbenannt in' androidTest', siehe Verlauf für https://github.com/Nodeclipse/nodeclipse-1/blob/master/org.nodclipse.enide .editors.gradle/docs/android/build.grandle –