I would like to install .apk files that will be used to run my tests using SpoonGradlePlugin.
There are available properties that I can programmatically set from the gradle file:
https://github.com/stanfy/spoon-gradle-plugin/blob/master/src/main/groovy/com/stanfy/spoon/gradle/SpoonExtension.groovy
But my project has different tastes and names, and I would like to test them. With the current setup, I get:
* What went wrong: A problem was found with the configuration of task ':app:spoonDebugAndroidTest'. > File '/Users/F1sherKK/Dev/MyApp-Android/app/build/outputs/apk/app-debug.apk' specified for property 'applicationApk' does not exist.
My build names:
app-debug-androidTest-unaligned.apk MyApp-debugA-1.2.3-201.apk MyApp-debugB-1.2.3-201.apk MyApp-debugC-1.2.3-201.apk
This is why I would like to configure my .apk somewhere in gradle code - or in the console. What I have found so far, there are fields available in the Spoon gradle plugin there:
https://github.com/stanfy/spoon-gradle-plugin/blob/master/src/main/groovy/com/stanfy/spoon/gradle/SpoonRunTask.groovy
with names:
@InputFile File instrumentationApk @InputFile File applicationApk
But I cannot access those that are in gradle as properties in SpoonExtension.groovy.
Is there any way to configure these fields?
// EDIT - some attempts were added: This is my basic spoon configuration:
spoon { debug = true baseOutputDir = file("$buildDir/spoon-log") if (project.hasProperty('spoonClassName')) { className = project.spoonClassName if (project.hasProperty('spoonMethodName')) { methodName = project.spoonMethodName } } }
And tasks that extend it and overwrite instumentationArgs to install the package and run other tests.
task spoonAllTests(type: GradleBuild, dependsOn: ['spoon']) { spoon { instrumentationArgs = ["package=com.myapp.sendmoney.instrumentation"] } } task spoonFlowTests(type: GradleBuild, dependsOn: ['spoon']) { spoon { instrumentationArgs = ["package=com.myapp.instrumentation.flowtests"] } }
And now I'm trying to edit the applicationApk or instrumentationApk file:



Edit2: I tried a new thing:
task spoonFlowTests(type: GradleBuild, dependsOn: ['spoon']) { spoon { inputs.property("applicationApk", "$buildDir/outputs/apk/ap12345p-debug.apk") inputs.property("instrumentationApk", "$buildDir/outputs/apk/ap125p-debug.apk") println inputs.getFiles() println inputs.getProperties() instrumentationArgs = ["package=com.azimo.sendmoney.instrumentation.flowtests"] } }
And the terminal response:
2015-10-26 20:24:12 [SR.runTests] Executing instrumentation suite on 0 device(s). 2015-10-26 20:24:12 [SR.runTests] Application: com.azimo.sendmoney.debug1 from /Users/F1sherKK/Dev/Azimo-Android/app/build/outputs/apk/app-debug.apk 2015-10-26 20:24:12 [SR.runTests] Instrumentation: com.azimo.sendmoney.debug1.test from /Users/F1sherKK/Dev/Azimo-Android/app/build/outputs/apk/app-debug-androidTest-unaligned.apk :app:spoon :app:spoonFlowTests file collection {instrumentationApk=/Users/F1sherKK/Dev/Azimo-Android/app/build/outputs/apk/ap125p-debug.apk, applicationApk=/Users/F1sherKK/Dev/Azimo-Android/app/build/outputs/apk/ap12345p-debug.apk} :Azimo-Android:app:help Welcome to Gradle 2.5. To run a build, run gradlew <task> ... To see a list of available tasks, run gradlew tasks To see a list of command-line options, run gradlew --help To see more detail about a task, run gradlew help --task <task> BUILD SUCCESSFUL Total time: 13.289 secs