Android test code coverage, Eclipse

前端 未结 4 867
不知归路
不知归路 2020-12-06 16:28

Is there a way to run unit tests for Android from Eclipse in a way that will instrument the code and measure test code coverage?

I\'m looking for a simple way to fi

4条回答
  •  星月不相逢
    2020-12-06 17:15

    Install EclEmma from Eclipse Marketplace.

    If you have /build.xml file rename it.

    I was able to generate test coverage report by executing following from the console:

    android update test-project -m -p + Enter,

    cd + Enter,

    ant emma debug install test + Enter,

    where is /opt/android-sdk-linux/tools/ on my machine - the folder where android SDK is installed.

    This generated /bin/coverage.html file.

    If you get "wrong JAVA_HOME" error execute gksu gedit /etc/environment + Enter, correct JAVA_HOME, save the file, log out or reboot and try again.

    Source: http://blog.rabidgremlin.com/2010/11/19/android-tips-generating-a-coverage-report-for-your-unit-tests/

提交回复
热议问题