Question

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 ?

Était-ce utile?

La 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

Autres conseils

  1. Include and export emma.jar into the project under test
  2. Create ant build files for both project under test and test project.
  3. Build ’instrument’ target for project under test
  4. Build ’debug emma install test’ target for the test project
  5. Run tests on emulator
  6. Results are found in bin folder of test project

Steps are from my presentation on jDays last year. I can recommend Android Application Testing Guide by Diego Torres Milano if you want to read up on Android unit testing.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top