Is it possible to simply compile an Emma instrumented APK using Android build.xml and not run any tests

前端 未结 2 1885
心在旅途
心在旅途 2021-01-18 10:02

I know of

ant coverage

However that does a few things, it compiles with emma instrumentation, installs, and runs the test apk. I don\'t wa

相关标签:
2条回答
  • 2021-01-18 10:59

    // coverage.py

    development\testrunner\coverage.py

    def TestDeviceCoverageSupport(adb): """Check if device has support for generating code coverage metrics.

    This tries to dump emma help information on device, a response containing help information will indicate that emma is already on system class path.

    Returns: True if device can support code coverage. False otherwise. """ try: output = adb.SendShellCommand("exec app_process / emma -h")

    if output.find('emma usage:') == 0:
      return True
    

    except errors.AbortError: pass return False

    adb shell exec app_process / eamm -h

    build core images http://duykham.blogspot.com/2009/09/how-to-get-emma-code-coverage-of.html

    0 讨论(0)
  • 2021-01-18 11:01

    Well for anyone interested. The SDK documentation is completely busted (surprising I know). Basically you have to do this,

    take the base build.xml generated by android create-project and change the tag

    <setup/>
    

    and change it to

    <setup import="false"/>
    

    Now the documentation will tell you to copy from SDK/platform-/templates/android_rules.xml and place that into your build.xml ... THIS IS WRONG and horribly unmaintained. This rules file isn't used by anything. What is used are the rules inside of SDK/tools/ant/. Grab the appropriate file for your type of project (library for a library project, test for a test project, or vanilla for a regualr project) with the latest _r and
    copy the contents of it's root node into your build.xml. Insert it after the setup tag. If you don't use the files inside the ant directory, you will not be able to compile project libraries through the ant script. I was so glad they maintained documentation on how to do this.

    Now you can change whatever you like in the build file to match your build needs. In which case I just made install-helper call my wrapper around adb which returns interpreted resultcodes.

    0 讨论(0)
提交回复
热议问题