Android 自动化测试—robotium(七)Ant 构建脚本

  robotium 的脚本是 Java 写的,就可以利用 ant 去构建。当然 build.xml 文件同 Selenium WebDriver 的 build.xml 也是不同的。

Ant:http://luwenjie.blog.51cto.com/925779/831345

可以参考 robotium 官方 Wiki 解决 Robotium 覆盖率的问题:

http://code.google.com/p/robotium/wiki/QuestionsAndAnswers

1.对于 robotium tests 我们不必自己写 build.xml。

参考一下命令:

android update test-project -m [path to target application] -p [ path to the foler ]



  

2.需要把 robotium.jar 放到测试项目的 libs 目录中,ant将来需要去引用



  

3.简单使用ant进行构建.

 

关键在于:<import file="${sdk.dir}/tools/ant/build.xml" />

自动生成的build.xml中将android自带的ant build 文件所包含进来。

这个build.xml 建议详细阅读,能够学到很多东西。



 因为这里default启动的是help,所以当我们直接运行 ant 时,将返回help内容


 



  

根据help提示,运行test 就是运行测试



  

当然我们可以更改default为test,那样默认运行ant 就是运行测试了。

 

 

本文出自 “小毛子” 博客,请务必保留此出处http://xiaomaozi.blog.51cto.com/925779/932284

猜你喜欢

转载自284772894.iteye.com/blog/2167201