android-junit-report工具实现android下junit框架测试自动生成报告
来源:互联网 发布:淘宝处罚考试虚假交易 编辑:程序博客网 时间:2024/05/21 10:06
下面使用android-junit-report工具实现android下junit框架测试自动生成报告,并发送邮件的功能
一、工具
1.android-junit-report------android下用该工具生成测试报告
download address: https://github.com/jsankey/android-junit-report/downloads
2.(可选)android-junit-report-master----工具的源码和使用例子
download address: https://github.com/jsankey/android-junit-report
二、使用
注:需要单独建一个测试工程,如果测试工程和项目工程是一个,ant debug install test 会报
\build.xml:617: subant task calling a target that depends on its parent target '-build-setup'.错误
1. * Edit AndroidManifest.xml to set android:name in the
instrumentation tag to:
com.zutubi.android.junitreport.JUnitReportTestRunner.
2. cmd: android update test-project -p [测试工程路径] -m [项目工程路径]
e.g. android update project -p e:\workspace\dd -m E:\workspace\dd\TestCalTest
生成android自动化的build.xml, ant.properties, local.properties
3.* Edit ant.properties to add the line:
test.runner=com.zutubi.android.junitreport.JUnitReportTestRunner
4.编写 custom_rules.xml
<?xml version="1.0" encoding="UTF-8"?><project name="Test">
<property name="reports.dir" value="bin/reprots"/>
<target name="makedir">
<mkdir dir="${reports.dir}"/>
<echo>=====maked reports dir</echo>
</target>
<!-- 拿到项目工程的package名-->
<target name="init-props">
<xpath input="${tested.project.dir}/AndroidManifest.xml"
expression="/manifest/@package" output="tested.project.app.package"/>
</target>
<!-- 将测试报告从android目录下拿到pc上 -->
<target name="fetch-test-report" depends="init-props,makedir">
<echo>Downloading XML test report...</echo>
<exec executable="${adb}" failonerror="true">
<arg line="${adb.device.arg}"/>
<arg value="pull"/>
<arg value="/data/data/${tested.project.app.package}/files/junit-report.xml"/>
<arg value="${reports.dir}/junit-report.xml" />
</exec>
</target>
<target name="test-and-fetch" depends="debug,install,test,fetch-test-report,send-mail"/>
<target name="send-mail">
<mail mailhost="mail.foxitsoftware.com" mailport="25" subject="Test build">
<from address="myself@xxx.com"/>
<to address="someone@xxx.com"/>
<message>test completed,see the file attachment </message>
<attachments>
<fileset dir="${reports.dir}">
<include name="*.xml"/>
</fileset>
</attachments>
</mail>
</target>
<!-- use execute python -->
<target name="test">
<exec executable="python" failonerror="true">
<arg value="hello.py"/>
</exec>
</target>
</project>
最后只要到测试工程下运行 ant test-and-fetch
- android-junit-report工具实现android下junit框架测试自动生成报告
- Android下junit测试框架配置
- Android下junit测试框架的配置
- android下junit测试框架配置
- Android使用Robotium自动化测试junit生成单元测试结果报告
- android测试框架Junit使用
- Android下的junit测试
- Android下的Junit测试
- Android下进行Junit测试
- android-junit-report-mail-python
- robotium+ant+android-junit-report
- android开发平台下搭建junit测试框架环境
- Android 中使用JUnit进行自动测试
- Android API_DEMO 及JUNIT测试工具使用
- Android API_DEMO 及JUNIT测试工具使用
- 自动生成Junit测试类
- Android之Junit测试框架配置
- Android Junit测试框架的配置
- linux下mysql的root修改密码忘记解决方法
- S3C2440 存储控制器和MMU浅析
- Shell文件参数和切分字符串实例代码
- ACM从零开始---电子科大POJ "选择排序算法"
- U-Boot添加menu命令的方法及U-Boot命令执行过程
- android-junit-report工具实现android下junit框架测试自动生成报告
- MVC Html.BeginForm 使用心得
- 数论整理
- uva 11404 Palindromic Subsequence (dp+字典序最小路径)
- Linux环境下GNU, GCC, G++编译器
- Spring--开篇
- solrconfig.xml配置详解
- 更改上传文件的样式<input type="file>
- plsql 格式化sql 语句