Android-Junit-Report測試報告產生——Android自動化測試學習曆程

來源:互聯網
上載者:User

標籤:

視頻地址:

http://www.chuanke.com/v1983382-135467-384869.html

這個內容其實已經在用了,我在上一篇文章robotium—只有apk檔案的測試中已經講過這個內容了,並且自己也用Python+wxpython寫了介面程式,來實現跑case+擷取xml運行結果+xml轉html+發送郵件的功能

主要內容:

一、測試需求

1、統計每個case的執行時間

2、哪些case成功、失敗

3、失敗的case給出log

4、產生網頁html報告結果

二、環境部署

以robotium為例,需要的環境:

1、JDK1.7、Android開發環境

2、Robotium的jar包

3、android-junit-report.jar包

三、報告產生原理

去官網瞅瞅:http://zutubi.com/,通過點擊open source可進入下載頁面下載

 

quick start

For the impatient, here is an overview of how to integrate the runner with Ant builds. Note all modifications are made to your test project, i.e. the project which implements the JUnit tests:

  •  Grab the jar from the downloads page and add it to your libs/ directory.
  •  Edit AndroidManifest.xml to set android:name in the <instrumentation> tag to:com.zutubi.android.junitreport.JUnitReportTestRunner.
  •  Edit ant.properties to add the line:
    test.runner=com.zutubi.android.junitreport.JUnitReportTestRunner
  •  Run your tests as you would normally:
    $ ant debug install test
  •  Pull the resulting XML report from the device (from the application under test‘s internal storage directory):
    $ adb pull /data/data/<main app package>/files/junit-report.xml
  •  Integrate the XML with your chosen build tool.

接下來就是原理:

1、com.zutubi.android.junitreport.JUnitReportTestRunner——具體見上面描述,需要修改的地方是兩個,一個是instrumentation的tag,一個是Run As的Run Configuration,修改Instrumentation runner的值

2、調用機制:

三層封裝:

Junit Report---》Robotium---》Instrumentation

四、指令碼實現自動化後續收集工作

指令碼1——運行testcase

指令碼2——把xml從手機記憶卡pull出來

指令碼3——把xml轉換成html

指令碼4——把html的報告合并到手工、壓力、效能報告中去

指令碼5——發送郵件周知即可

Done!還是需要自己去寫。。。

Android-Junit-Report測試報告產生——Android自動化測試學習曆程

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.