Hi,
the JaCoCo runtime allows to configure the output location for the exec
file. You probably need to select a writable part of the file Android
system. See 'destfile' property:
http://www.eclemma.org/jacoco/trunk/doc/agent.html
As you are probably using offline instrumented classes for Android here
you find how to configure the JaCoCo runtime in this case:
http://www.eclemma.org/jacoco/trunk/doc/offline.html
Best regards,
-marc
On 2014-07-25 04:39, [email protected] wrote:
Hi all,
I'm a beginner in JacoCo and encounter problem of jacoco.exec not
created after running Android tests. Can you please help to point out
what needs to be changed or done? Also, does it require using an
argument for JaCoCo agent when executing test? Thank you very much!
I read the JaCoCo plug-in section in Gradle User Guide
(http://www.gradle.org/docs/current/userguide/jacoco_plugin.html) and
Android Studio page, as well as searching for answers in Google. One
issue is that Gradle should not take both android and java plugins so
I cannot use the test task from java plugin to specify JaCoCo
destinationFile and classDumpFile values as stated in Gradle User
Guide.
Dev. environment:
Gradle 2.0
JaCoCo 0.7.1.201405082137
JDK 1.7.0_65
Android compiled SDK version 20
Android build tools version 20.0.0
Android Studio 0.8.2
Android version on test device 4.2.2
logcat message from executing Android tests:
07-24 19:30:47.990 10149-10165/? W/System.errīš
java.io.FileNotFoundException: /jacoco.exec: open failed: EROFS
(Read-only file system)
Below are the additions in the module's build.gradle file to support
JaCoCo:
apply plugin: "jacoco"
android {
buildTypes {
debug {
testCoverageEnabled true
}
release {
testCoverageEnabled true
runProguard false
proguardFiles
getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
jacoco {
println "jacoco version"
version "0.7.1.201405082137"
}
}
jacoco {
toolVersion = "0.7.1.201405082137"
reportsDir =
file("<absolute_path_to_project>/app/build/customJacocoReportDir")
}
def coverageSourceDirs = [
'<absolute_path_to_project>/app/src/main'
]
task jacocoTestReport(type: JacocoReport, dependsOn: "testDebug") {
group = "Reporting"
description = "Generate Jacoco coverage reports after running
tests."
reports {
xml.enabled = true
xml.destination =
"<absolute_path_to_project>/app/build/reportXML"
html.enabled = true
html.destination =
"<absolute_path_to_project>/app/build/reportHTML"
}
classDirectories = fileTree(
dir:
'<absolute_path_to_project>/app/build/intermediates/coverage-instrumented-classes/debug',
)
sourceDirectories = files(coverageSourceDirs)
executionData = files("jacoco.exec")
}
--
You received this message because you are subscribed to the Google Groups "JaCoCo
and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.