Hello guys,
Currently, I'm researching about GUI automated testing on Android and for some reason, I need a tool that can generate code coverage report from manual testing.
Since Google has officially ended support android developer tools for Eclipse, I need a tool that works on Android Studio and Gradle, not ant or maven.
After a long searching, I found that Jacoco and Emma mention the manual approach on the website.
But unfortunately, There is not any 'up-to-date-working example' on the internet.
I have tried a lot of suggesting solution, for example, this one.
It generated a coverage.exec but the file's size was only few byte (of course, Jacoco failed to generate any report from it.)
Here is what I have tried: https://github.com/kindraywind/MyDummy
In app/build.gradle
apply plugin: 'jacoco'jacoco {
toolVersion ="0.7.8+" //I did try "0.7.4+" as the suggest.
}
task jacocoTestReport(type: JacocoReport) { … }
In jacoco-agent.properties
destfile=/storage/sdcard/coverage.exec
In app/src/main/AndroidManifest.xml
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
In MainActivity.java
protected void onStop()
{
super.onStop();
if(BuildConfig.DEBUG)
{
String TAG = "jacoco";
try {
String covPath = Environment.getExternalStorageDirectory().getPath() + "/coverage.exec";
File coverageFile = new File(covPath);
Class<?> emmaRTClass = Class.forName("com.vladium.emma.rt.RT");
Method dumpCoverageMethod = emmaRTClass.getMethod("dumpCoverageData",coverageFile.getClass(), boolean.class, boolean.class);
dumpCoverageMethod.invoke(null, coverageFile, true, false);
} catch (Exception e) {
}
}
}
The emulator is Nexus 5 API 19 (I did try most of the versions.)
The log from device
EMMA: runtime coverage data merged into [/storage/sdcard/coverage.exec] {in 8 ms}
The log after run ./gradlew jacocoTestReport
Unable to read execution data file /Users/MyDummy/app/coverage.exec
I'm using OSX10.12.3 if it related.
To sum up, I need to know (or any working example) how to obtain codecoverage while:
- Test the app manually.
- On Android application.
- Which is using Gradle not Maven or Ant.
- Android Studio not Eclipse.
I see no way out and would really appreciate a help.
Regards,
-Woramet
I recently encountered the same issue. You can read my solution here:
http://curiousily.com/dev/2017/03/02/code-coverage-for-manual-android-testing.html
Write back in the comment section if you need any help. What are your interests regarding automated GUI testing?
--
You received this message because you are subscribed to a topic in the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jacoco/BOh8Rm3y1-M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/952ff218-d9fd-4f79-b315-cc967c939695%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I am dealing with a similar problem with code coverage collection. Venelin, thanks for the great set of instructions. Do you have any ideas on how to collect code coverage for manual testing with Ant and Jacoco?
I am working on research into algorithmic approaches to automated GUI testing. Some of the apps I work with use the Ant build system rather than Gradle.
On Monday, 10 April 2017 04:17:32 UTC-5, Woramet muangsiri wrote:
> Hi, Venelin,
> Thank you for such clear instruction. Unfortunately, I still got the same problem. coverage.exec file is broken (only 37bytes) :(
>
>
> would you mind if I ask you to you make an example repo on the GitHub, please?
>
>
> (I'm researching about automated testing with some language model. :))
>
>
> On Sat, Mar 18, 2017 at 4:44 AM, <veneli...@gmail.com> wrote:
> Hi Woramet,
>
>
>
> I recently encountered the same issue. You can read my solution here:
>
>
>
> http://curiousily.com/dev/2017/03/02/code-coverage-for-manual-android-testing.html
>
>
>
> Write back in the comment section if you need any help. What are your interests regarding automated GUI testing?
>
>
>
> --
>
> You received this message because you are subscribed to a topic in the Google Groups "JaCoCo and EclEmma Users" group.
>
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/jacoco/BOh8Rm3y1-M/unsubscribe.
>
> To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.
Hi Venelin,
Thank you for sharing the solution. I also tried the steps mentioned in your blog.But I am always getting 37 bytes file:
adb pull /sdcard/coverage.exec app/build/outputs/code-coverage/connected/coverage.exec
0 KB/s (37 bytes in 0.078s)
Please help in resolving this issue. Thanks in advance.
Regards,
Shanky