robotium+ant+android-junit-report

独自空忆成欢 提交于 2019-11-28 11:37:42
  1. 根据此链接的步骤为现有的robotium项目自动生成ant的build.xml文件:http://xiaomaozi.blog.51cto.com/925779/932284/

  2. 根据此链接的步骤将android-junit-report.jar导入项目并根据链接上的内容操作:http://www.xuebuyuan.com/2148574.html

  3. http://www.tuicool.com/articles/Rzayie 

    将如下代码加入到build.xml文件中去:

 

    <target name="fetch-test-report">

         <xpath input="${tested.project.dir}/AndroidManifest.xml"

              expression="/manifest/instrumentation/@android :targetPackage" output="tested.package"/>

          <echo>Downloading XML test report...</echo>

          <mkdir dir="${reports.dir}"/>

          <exec executable="${adb}" failonerror="true">

          <arg line="${adb.device.arg}"/>

          <arg value="pull" />

          <arg value="/data/data/${tested.package}/files/junit-report.xml"/>

          <arg value="${reports.dir}/junit-report.xml"/>

        </exec>

    </target>

"/manifest/instrumentation/@android :targetPackage"这里要注意指的是应该指向测试项目中AndroidManifest.xml中的instrumentation的package,不然会报错。

<instrumentation 

       android:name="com.zutubi.android.junitreport.JUnitReportTestRunner"

       android:targetPackage="com.example.example"/>

还要在ant.property中添加

test.runner=com.zutubi.android.junitreport.JUnitReportTestRunner

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!