Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Android code coverage instructions | |
| 2 | |
| 3 This is instruction for code coverage for android instrumentation and junit test s. | |
| 4 | |
| 5 [TOC] | |
| 6 | |
| 7 ## 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.
| |
| 8 | |
| 9 In order to use emma code coverage, we need to create build time .em file and ru n time | |
|
mikecase (-- gone --)
2016/06/01 21:59:20
nit: s/run time/runtime
BigBossZhiling
2016/06/01 23:36:24
Done.
| |
| 10 .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.
| |
| 11 | |
| 12 ## 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.
| |
| 13 | |
| 14 1. Build your APK with the GN arg emma_coverage=true. | |
| 15 ``` | |
| 16 gn args out-gn/Debug | |
| 17 > target_os = "android" | |
| 18 > emma_coverage = true | |
| 19 ``` | |
| 20 By doing so, .em files will be created in out-gn/Debug. | |
| 21 2. Run tests, with option `--coverage-dir <directory>`, to specify where to save | |
| 22 the .ec file. For example, you can run chrome junit tests: | |
| 23 `out-gn/Debug/bin/run_chrome_junit_tests --coverage-dir /tmp/coverage`. | |
| 24 3. Now we have both .em and .ec files. We can merge them and create a html file, | |
| 25 using generate_emma_html.py. For example, generate_emma_html.py can be called | |
| 26 this way: | |
| 27 `build/android/generate_emma_html.py --coverage-dir /tmp/coverage/ | |
| 28 --metadata-dir out-gn/Debug/ --output example.html`. | |
| 29 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.
| |
| 30 `EMMA: writing [html] report to | |
| 31 [<your_current_directory>/example.html] …` | |
| OLD | NEW |