Android自动化测试生成单元测试结果报告

发表于:2013-11-13 11:38

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:hunterno4    来源:51Testing软件测试网采编

分享:
  2.修改AndroidManifest.xml文件
  将原来的:
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.example" />
  修改为:
<instrumentation
android:name="com.example.test.instrumentation.InstrumentationTestRunner"
android:targetPackage="com.example" />
  3.修改Run Configurations
  右键测试工程>Run as >Run Configurations
  在Test栏中,勾选Run all tests in the selected project,or package
  这样每次在Eclipse中运行时才会使用新的InstrumentationTestRunner
  在Instrumentation runner处下拉选择新写的InstrumentationTestRunner
  点击Apply完成设置
  4.命令行下运行测试用例
Running all tests: adb shell am instrument -w com.android.foo/com.example.test.instrumentation.InstrumentationTestRunner
Running a single testcase: adb shell am instrument -w -e class com.android.foo.FooTest com.android.foo/com.example.test.instrumentation.InstrumentationTestRunner
Running multiple tests: adb shell am instrument -w -e class com.android.foo.FooTest,com.android.foo.TooTest com.android.foo/com.example.test.instrumentation.InstrumentationTestRunner
  命令行下运行测试用例与平时一样,只要将原来的InstrumentationTestRunner换成新的InstrumentationTestRunner就行,
  需要注意的是,由于每次命令行执行完毕,都会覆盖原有的TEST-all.xml文件,即如果采用Running a single testcase方式运行多个测试用例集,则最后结果只会记录最后一个用例集,因此建议采用Running multiple tests方式
  5.运行完成后将手机中的文件导出
  adb -s $ANDROID_AVD_DEVICE pull /mnt/sdcard/rototium/TEST-all.xml
  其中$ANDROID_AVD_DEVICE为参数化的手机序列号
  6.在jenkins中任务构建完成后即可使用Publish JUnit test result report插件分析得出单元测试报告了
33/3<123
精选软件测试好文,快来阅读吧~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号