Search code examples
androidcode-coveragechromiumemma

How to find code coverage of test cases run on chromium for android?


What are the tools available ? I am working on Ubuntu. I cannot use Visual studio tools. Can I use Emma? If so, How?

EDIT:I am using emma. I was able to generate the coverage.em file using the following command:

java -cp ./third_party/android_tools/sdk/tools/lib/emma.jar emma instr -m overwrite -cp out/Release/unit_tests_apk/

But the coverage.ec was not generated. Any ideas ? Any other way to generate the code coverage for chromium android ?


Solution

  • The below step will create .em files in out/Release/lib.java and .ec files in the coverage directory mentioned (out/Release/CoverageDirectory):

    build/android/test_runner.py instrumentation --test-apk=ContentShellTest --release -vvv --coverage-dir out/Release/CoverageDirectory
    

    The below step will take the coverage directory (containing .ec files) mentioned above and the out/Release directory (containing .em files generated above) and generate the html coverage report.

    build/android/generate_emma_html.py --coverage-dir out/Release/CoverageDirectory --metadata-dir out/Release --cleanup --output out/Release/CoverageDirectory/coverage_html/index.html