使用 ant 构建 Android 测试时如何使用 emma 过滤器?
我知道在构建 Android 测试项目时如何在 ant 中使用 emma,但在使用 SDK 时找不到任何有关如何使用过滤器的提示。 emma 网站在自己调用 emma 时对此进行了解释,但在 Android SDK 构建文件中 emma 并未在 ant 文件或命令行中调用,因此我无法添加过滤器选项。
有人有什么建议吗?
I know how to use emma in ant when building my android test project but I can't find any tips on how to use filters when using the SDK. The emma website explains it when calling emma yourself but in the Android SDK build files emma is not called in the ant files or on the commandline so I'm not able to add the filter options.
Anyone any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从 SDK Tools r18 开始,您只需添加
到项目的 ant.properties(不是测试项目)
As of SDK Tools r18 you can simply add
to the ant.properties of your project (not Test project)
这取决于您使用的 SDK 版本,特别是
/tools/ant
目录中包含的构建文件。Android SDK >= 18
从 SDK r18 及更高版本开始,只需将属性添加到目标(非测试)项目的
ant.properties
文件即可。例如,使用从测试包中排除所有类。您可以在 emma 文档 中找到 emma 过滤器语法。
Android SDK< 18
此问题存在问题。它涉及以下内容:
-emma-instrument
目标来修改构建文件文件(您应该在通过运行android create/update project
获得的标准项目构建文件中找到此方法的说明)根据链接的问题修改目标,它会看起来像:
排除过滤器语法的解释可在 emma 文档
emma.exclusion.pattern< /code> 提供您自己的排除项
对我来说,这在 SDK 工具 r13 上就像一个魅力。
It depends on the SDK version you are using, specifically the included build files found in
<android-sdk>/tools/ant
directory.Android SDK >= 18
As of the SDK r18 and above it's as simple as adding a property to your
ant.properties
file of the target (not test) project. So for example useTo exlude all classes from a test package. You can find the emma filter syntax in the emma documentation.
Android SDK < 18
There's an issue for this. It involves the following:
-emma-instrument
target from the imported android build files (you should find an explanation of this method in the standard project build file which you get by runningandroid create/update project
)modify the target according to the linked issue, it'll look like:
an explanation of the exclusion filter syntax is available on the emma documentation
emma.exclusion.pattern
to provide your own exclusionsFor me this has worked like a charm on SDK tools r13.