???????????????????????????????????????????Щ??????δ???????δ???????????????ζ??δ???????????????????Andriod??????????????????????????????2??????????????????ο???

???????Andriod???????????Java????????????Andriod native C???????????????(?????????????????????gcov????)??Java??????????????????????????????Emma??Emma??????????????????????? ??????????????????????????????(?ο?????????£?)??

 

????1??????????????????????????????????gcov?????????????????


????2??????????????Emma?????Java class???????Oolong??????????????????????????????????????????Java????????(Debug)?棬???????Emma?????Oolong????????????????????????????????class?????????.source?? .line. .var??Щ???????????????????Java?????Java??????Oolong???????????????????????????????????????????????????? Java?????????Scala???????????????涼??????Emma?????????????????????Java?????????????????ο??鼮??Programming for the Java™ Virtual Machine????7???????????

???????Andriod??????????豸???????и?????(dx)??Java????????Andriod??????????????????????????????Emma???class???????????

 

?????????Andriod???????ant?? build?????????????????????????????????????????????????????????????衣???????????????????ant????????????????棺


????1????eclipse??andriod?????????????ant??build?????andriod-app?????????

????android update project -p android-app


????2????eclipse??andriod?????????????ant?????-m????????????????????andriod?????λ?????android-test????????????

 

????android update test-project -m ../android-app -p android-test


????3????????????????????е?????????????????

????ant clean emma debug install test

????4?????豸???/data/data//?????????files?????????coverage.ec??????????????????????????????????????????????????????????Щ????????????

????5????????coverage.ec?????????andriod???????bin???????????????????????????coverage.em????????????????????????????????????

????6????????????????????????????(andriod SDK??????????emma.jar)?????????????sp??????????? ??????λ???

 

????java -cp ~/android-sdk/tools/lib/emma.jar emma report -r html -in coverage.em -in coverage.ec -sp ~//src/

?????????????ant??????(?????????andriod eclipse?????????ant??????)?????????????漸??????????????????~/research/multiplatformdemoproject??andriod????????·????


????cd ~/research/multiplatformdemoproject/

 

????# ?????????

 

????ant debug

????# ??????dex??????????class?????

????cd bin

????java -cp ~/android-sdk/tools/lib/emma.jar emma instr -ip classes -d instrumented

 

????# ????????????????class?????????andriod????????


????~/android-sdk/platform-tools/dx --dex --debug --no-optimize --output=classes.dex instrumented


????~/android-sdk/platform-tools/aapt package -v -f -M /home/shiyimin/research/multiplatformdemoproject/AndroidManifest.xml -S /home/shiyimin/research/multiplatformdemoproject/res -I /home/shiyimin/android-sdk/platforms/android-8/android.jar -F multiplatformdemoproject.unsigned.apk /home/shiyimin/research/multiplatformdemoproject/bin/


????# ???

????jarsigner -keystore ~/.android/debug.keystore -storepass android -keypass android -signedjar multiplatformdemoproject.signed.apk multiplatformdemoproject.unsigned.apk androiddebugkey

 

????~/android-sdk/tools/zipalign 4 multiplatformdemoproject.signed.apk multiplatformdemoproject.apk

 

????# ???????????豸??


????~/android-sdk/platform-tools/adb install multiplatformdemoproject.apk


????# ???????????

 

????cd tests

????ant debug

 

????# ????????в???????

????~/android-sdk/platform-tools/adb install multiplatformdemoproject.test-debug.apk

 

????~/android-sdk/platform-tools/adb shell am instrument -w -e coverage true cc.iqa.studio.demo.test/android.test.InstrumentationTestRunner

 

????# ????????????????

????cd http://www.cnblogs.com/bin/

????~/android-sdk/platform-tools/adb pull /data/data/cc.iqa.studio.demo/files/coverage.ec .


????java -cp ~/android-sdk/tools/lib/emma.jar emma report -r html -in coverage.em -in coverage.ec -sp ~/research/multiplatformdemoproject/src/

????????????????