我的主要项目是一个android库。我创建了一个包含一些单元测试的测试项目。测试运行良好,但我正在努力获得测试覆盖率。当我生成覆盖率报告时,我只得到测试用例的覆盖率,而不是库的覆盖率。所以它给了我几乎 100%,因为 100% 的测试正在运行。但这并不能帮助我判断图书馆的哪一部分已经过测试。
这就是我目前的做法:
0) my project looks like this:
myLibraryProject <- this is my android library project
myLibraryProject/tests <- this is my android test project
1) build.xml file : (from myLibraryProject/tests directory)
>android update test-project --path . -m ../
2) Modify the ant.properties file :
#tested.project.dir=../
android.library.reference.1=..
3) only then can I run :
ant emma debug install test
如果我不执行步骤 2),那么步骤 3) 将失败,因为无法安装库项目
任何帮助将不胜感激!