Dear All,

I am creating the code coverage report but I am not able to get the
data in the code coverage. it says 0% code coverage.
Following are the steps :

I have import the ApiDemos as the main project. Then I created the
ApiDemosTest project for testing.Here I have copied the test folder of
ApiDemos into the ApiDemosTest src folder.
All the tests runs fine

Then i created the coverage.ec file with the help of adb shell command
as follows :
G:\android\android-sdk_r04-windows\android-sdk-windows\tools>adb shell
am instru
ment -w -e emma true -e coverage true com.example.android.apis.tests/
android.tes
t.InstrumentationTestRunner
com.example.android.apis.ApiDemosApplicationTests:....
com.example.android.apis.ApiDemosTest:.
com.example.android.apis.app.ForwardingTest:...
com.example.android.apis.app.LocalServiceTest:.....
com.example.android.apis.os.MorseCodeConverterTest:.
com.example.android.apis.view.Focus2ActivityTest:....
com.example.android.apis.view.Focus2AndroidTest:....Generated code
coverage data
 to /data/data/com.example.android.apis/files/coverage.ec

The above command run successfully and I copied the coverage.ec file
into the tools directory through adb pull command.
I don't found the coverage.em file there. Then I found the solution to
create this file as follows.

I also run the ApiDemosTest project as the Android project through
which i get the compiled code in the bin directory.
Then I created the coverage.em file with the following command:
C:\androidworkspace\ApiDemos_2_1_Test>java emma instr -ip bin -outdir
out
EMMA: processing instrumentation path ...
EMMA: instrumentation path processed in 769 ms
EMMA: [14 class(es) instrumented, 0 resource(s) copied]
EMMA: metadata merged into [C:\androidworkspace\ApiDemos_2_1_Test
\coverage.em] {
in 78 ms}

out folder is generated with the class files and coverage.em file is
also generated.
Then I copied this coverage.em file into the tools directory. After
that I created the report though this command:
G:\android\android-sdk_r04-windows\android-sdk-windows\tools>java -cp
emma.jar e
mma report -r html -in coverage.ec -sp C:\androidworkspace
\ApiDemos_2_1_Test\src
 -in coverage.em
EMMA: processing input files ...
EMMA: 2 file(s) read and merged in 11 ms
EMMA: no collected coverage data found in any of the data files [all
reports wil
l be empty]
EMMA: writing [html] report to [G:\android\android-sdk_r04-windows
\android-sdk-w
indows\tools\coverage\index.html] ...

I have got the coverage report with 0% coverage as it is written in
"no collected coverage data found in any of the data files" above.

please tell me why the coverage report is not showing properly.
how the coverage data can be collected into the both files.
I have also checked size of both the files.
I found that coverage.ec file is 1KB memory while coverage.em file is
5 KB.
Then I come to conclusion that coverage.ec file do not contain
coverage data.
Is my assumption right or wrong.

Tell me where I am wrong?
Please suggest me some solution in this regard so that I can get the
coverage result fine.

Waiting for your reply.

Thanks and Regards
Neeraj

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to