Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1540845
  • 博文数量: 237
  • 博客积分: 5139
  • 博客等级: 大校
  • 技术积分: 2751
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-18 14:48
文章分类

全部博文(237)

文章存档

2016年(1)

2012年(4)

2011年(120)

2010年(36)

2009年(64)

2008年(12)

分类: 嵌入式

2011-07-29 09:43:02

一. 用ant, 通过修改build.xml来执行
1. 首先编译test project,注意,如果没有release key,只能编译 debug版本(在eclipse下会用自签名的key签名)
2. 执行ant -p,列出可执行的target选项。到底有哪些target, 由build.xml中说明来决定的
     
      

3. 然后用ant targetname, 做相应的事情
     eg. ant debug: Builds the application and signs it with a debug key.
           ant coverage:Runs the tests against the instrumented code and generates code coverage report
   ant run-tests: Runs tests from the package defined in test.package property
4. ant coverage 可以 生成html报表,但必须在emulaotr上跑才能生成,在device上跑不能生成

二. 用adb shell am instrument命令来执行
需要借助com.zutubi.android.junitreport.JUnitReportTestRunner
The runner supports two arguments:
  * reportFilePath: the path, relative to the root of the tested
    application's file storage area, of the report file to generate.
    Defaults to junit-report.xml.
  * filterTraces: if true, stack traces in the report will be filtered
    to remove common noise (e.g. framework methods).  Defaults to
    true.
命令格式为:
adb shell am instrument -w -e reportFilePath my-report.xml \
  com.example.test/com.zutubi.android.junitreport.JUnitReportTestRunner
阅读(4846) | 评论(2) | 转发(0) |
给主人留下些什么吧!~~

joyce_mhj2013-02-04 11:49:33

而且用它自带的,编译没有起作用,因为运行的还是未编译的,是什么原因呢?

joyce_mhj2013-02-04 11:48:59

<import file="${sdk.dir}/tools/ant/pre_setup.xml" />   
这份xml里面并没有 ant coverage这个命令呀?