小编Edu*_*ora的帖子

如何使用Maven在Android中获取代码覆盖率(android-maven-plugin)

我有一个包含各种子模块的Android Maven项目(我们称之为parent_project):my_library_project,app_using_my_library_project,test_projectextra_lib.

所以,结构将是这样的:

parent_project
   * my_library_project (Android Library Project)
   * app_using_my_library_project (Demo app that uses the Android Library Project)
   * test_project (Project containing the tests instrumented against app_using_my_library_project)
   * extra_lib
Run Code Online (Sandbox Code Playgroud)

我想要的是使用Maven为我的Android项目生成测试覆盖率(而不是Ant,我已经能够使用Ant生成代码覆盖率报告,遵循这些说明:https://wiki.jenkins-ci.org/display/ JENKINS/Building + an + Android + app +和+ test + project).

我对使用的代码覆盖工具没有强烈的偏好,但我更喜欢EMMA,因为它似乎是Android开发世界中最常见的.

我在其3.0.0-alpha-12版本中使用android-maven-plugin(http://code.google.com/p/maven-android-plugin/),我已经尝试将我的配置放入父母的pom.xml下一个:

<test>
  <coverage>true</coverage>
  <createreport>true</createreport>
</test>
Run Code Online (Sandbox Code Playgroud)

但这并不能产生所需的代码覆盖率报告.

所以:

  • 获取标准Java项目和Android项目的代码覆盖率的pom配置之间有什么区别吗?
  • 你知道任何使用Maven的Android项目有代码覆盖吗?
  • 关于如何做到这一点的任何提示?

android code-coverage maven

11
推荐指数
1
解决办法
3871
查看次数

是否在Python上使用zlib.compress,在Java(Android)上兼容Deflater.deflate?

我正在将一个Python应用程序移植到Android,并且在某些时候,该应用程序必须与Web服务进行通信,并向其发送压缩数据.

为此,它使用下一个方法:

def stuff(self, data):
    "Convert into UTF-8 and compress."
    return zlib.compress(simplejson.dumps(data))
Run Code Online (Sandbox Code Playgroud)

我正在使用下一个方法尝试在Android中模拟此行为:

private String compressString(String stringToCompress)
{
    Log.i(TAG, "Compressing String " + stringToCompress);
    byte[] input = stringToCompress.getBytes(); 
    // Create the compressor with highest level of compression 
    Deflater compressor = new Deflater(); 
    //compressor.setLevel(Deflater.BEST_COMPRESSION); 
    // Give the compressor the data to compress 
    compressor.setInput(input); 
    compressor.finish(); 
    // Create an expandable byte array to hold the compressed data. 
    // You cannot use an array that's the same size as the orginal because 
    // there …
Run Code Online (Sandbox Code Playgroud)

python java android zlib deflate

6
推荐指数
2
解决办法
3233
查看次数

标签 统计

android ×2

code-coverage ×1

deflate ×1

java ×1

maven ×1

python ×1

zlib ×1