2010-05-04 4 views

답변

8

분명히 EMMA는 SDK에서 지원되지 않습니다. 소스 트리의 일부인 Apps 및 Test에서만 지원됩니다. EMMA 계측 옵션에 대해 알려주는 개발 가이드에서 언급하지 않기 때문에 이상하게 보입니다. http://developer.android.com/guide/developing/testing/testing_otheride.html#AMOptionsSyntax

당신은이 사람의 응답 읽을 수

(개발 팀의 일원으로 나타 납니까? 나는 몰라) http://groups.google.com/group/android-developers/msg/a542afd318832371

을 다운로드하고 EMMA 작동 얻기 위해 가능한 소리 안드로이드 소스를 구축하려면 자신의 앱을 위해. 그러나, 그것은 다소 까다 롭고 아마도 약간 불안정한 것처럼 들립니다. 자세한 내용은 전체 스레드를 참조하십시오. http://groups.google.com/group/android-developers/browse_thread/thread/43cf8a8ca5662f85/9b68eec3e7b625f3?lnk=gst&q=Emma#

+3

이 대답이 유효한지 전혀 알 수 없습니다. 2 년 전, 안드로이드 2.0이 아직 베타 상태 였을 때 쓰여졌습니다. – plainjimbo

9

나는 ant를 사용하여 emma를 작동시킬 수있었습니다. 당신이 가지고있는 경우에 개미 빌드를 실행할 수있는 다음 설정 :

ant emma debug install 
ant emma debug install test 

첫 번째 프로젝트 디렉토리에 실행, 테스트 디렉토리에서 두 번째. 자세한 내용은 문서를 참조하십시오 : 당신은 개미 build.xml 파일이없는 경우 http://developer.android.com/guide/developing/building/building-cmdline.html

이미 여기에 현재 프로젝트에서 하나를 생성하는 방법을 볼 수 있습니다 http://developer.android.com/guide/developing/projects/projects-cmdline.html

슬픈 부분은이는 것 에뮬레이터 또는 루팅 된 장치에서 작업하십시오. 이는 루트가 필요한 폴더에서 커버리지 파일이 생성되기 때문이다. 또한 안드로이드 -sdk/tools/ant/build.xml 파일을 수정하여 뿌리 내 기기의 파일을 다른 곳으로 복사해야만 할 수있었습니다.

http://code.google.com/p/maven-android-plugin/wiki/EmmaMaven

그것이 : 뿌리 장치 확인이 위키와 매우 간단하다

<if condition="${emma.enabled}"> 
     <then> 
      <echo>WARNING: Code Coverage is currently only supported on the emulator and rooted devices.</echo> 
      <run-tests-helper emma.enabled="true"> 
       <extra-instrument-args> 
        <arg value="-e" /> 
         <arg value="coverageFile" /> 
         <arg value="${emma.dump.file}" /> 
       </extra-instrument-args> 
      </run-tests-helper> 
      <echo>Copying coverage to readable directory...</echo> 
      <exec executable="${adb}" failonerror="true"> 
       <arg line="${adb.device.arg}" /> 
       <arg value="shell" /> 
       <arg value="echo cp ${emma.dump.file} /sdcard/coverage.ec | su" /> 
      </exec> 
      <echo>Downloading coverage file into project directory...</echo> 
      <exec executable="${adb}" failonerror="true"> 
       <arg line="${adb.device.arg}" /> 
       <arg value="pull" /> 
       <arg value="/sdcard/coverage.ec" /> 
       <arg value="coverage.ec" /> 
      </exec> 
      <echo>Extracting coverage report...</echo> 
      <emma> 
       <report sourcepath="${tested.project.absolute.dir}/${source.dir}" 
            verbosity="${verbosity}"> 
        <!-- TODO: report.dir or something like should be introduced if necessary --> 
        <infileset dir="."> 
         <include name="coverage.ec" /> 
         <include name="coverage.em" /> 
        </infileset> 
        <!-- TODO: reports in other, indicated by user formats --> 
        <html outfile="coverage.html" /> 
       </report> 
      </emma> 
      <echo>Cleaning up temporary files...</echo> 
      <delete file="coverage.ec" /> 
      <delete file="coverage.em" /> 
      <echo>Saving the report file in ${basedir}/coverage/coverage.html</echo> 
     </then> 
     <else> 
      <run-tests-helper /> 
     </else> 
    </if> 
+0

SDK 파일의 적용 범위를 얻을 수 있습니까? – NioShobu

+0

안드로이드 api의 적용을받지 않습니다. 패키지에있는 출처. – Grimmace

1

프로젝트에 대한 받는다는을 사용하는 경우 : 나는 다음과 같은 일하기 위해 XML의 엠마 블록을 수정 솔루션을 구현하기 쉬운 보고서 생성 위키의 의견을 확인하면 해결책을 찾을 수 있습니다.

관련 문제