robotium+ant+android-junit-report

  1. 根据此连接的步骤为现有的robotium项目自动生成ant的build.xml文件:http://xiaomaozi.blog.51cto.com/925779/932284/html

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

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

    将以下代码加入到build.xml文件中去:测试

 

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

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

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

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

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

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

          <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

相关文章
相关标签/搜索
本站公众号
   欢迎关注本站公众号,获取更多信息