Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Unified Diff: build/android/docs/coverage.md

Issue 2031743002: Added instructions on how to use code coverage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/docs/coverage.md
diff --git a/build/android/docs/coverage.md b/build/android/docs/coverage.md
new file mode 100644
index 0000000000000000000000000000000000000000..69172bcfd19fcb15c51f4fbab720aa81f8a04f22
--- /dev/null
+++ b/build/android/docs/coverage.md
@@ -0,0 +1,31 @@
+# Android code coverage instructions
+
+This is instruction for code coverage for android instrumentation and junit tests.
+
+[TOC]
+
+## How emma coverage works
mikecase (-- gone --) 2016/06/01 21:59:20 nit: everywhere s/emma/EMMA
BigBossZhiling 2016/06/01 23:36:24 Done.
+
+In order to use emma code coverage, we need to create build time .em file and run time
mikecase (-- gone --) 2016/06/01 21:59:20 nit: s/run time/runtime
BigBossZhiling 2016/06/01 23:36:24 Done.
+.ec file. Then we need to merge them to become a readable html file.
mikecase (-- gone --) 2016/06/01 21:59:20 nit: everywhere............ s/.ec/**.ec** s/.em/*
BigBossZhiling 2016/06/01 23:36:24 Done.
+
+## Steps to make use of code coverage
mikecase (-- gone --) 2016/06/01 21:59:20 nit: s/Steps to make use of code coverage/How to c
BigBossZhiling 2016/06/01 23:36:24 Done.
+
+1. Build your APK with the GN arg emma_coverage=true.
+ ```
+ gn args out-gn/Debug
+ > target_os = "android"
+ > emma_coverage = true
+ ```
+ By doing so, .em files will be created in out-gn/Debug.
+2. Run tests, with option `--coverage-dir <directory>`, to specify where to save
+ the .ec file. For example, you can run chrome junit tests:
+ `out-gn/Debug/bin/run_chrome_junit_tests --coverage-dir /tmp/coverage`.
+3. Now we have both .em and .ec files. We can merge them and create a html file,
+ using generate_emma_html.py. For example, generate_emma_html.py can be called
+ this way:
+ `build/android/generate_emma_html.py --coverage-dir /tmp/coverage/
+ --metadata-dir out-gn/Debug/ --output example.html`.
+ Then an example.html containing coverage info will be create:
mikecase (-- gone --) 2016/06/01 21:59:20 nit: s/create/created
BigBossZhiling 2016/06/01 23:36:24 Done.
+ `EMMA: writing [html] report to
+ [<your_current_directory>/example.html] …`
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698