• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • Android系統單元測試方法(21)

    發表于:2011-06-30來源:未知作者:領測軟件測試網采編點擊數: 標簽:
    adbshellaminstrumente class com.android.testapp.test.TestMainActivitywcom.android.testapp/android.test.InstrumentationTestRunner adb shell am instrument e class com.android.testapp.test.TestMainActivi
    收藏代碼
    1. adb shell am instrument –e class com.android.testapp.test.TestMainActivity –w com.android.testapp/android.test.InstrumentationTestRunner  


    即可看到如下的結果:

    可以看到,單元測試正確的找到了減法中的錯誤。結果中的成功的測試顯示為”.”,一個失敗的顯示為”F”。只不過我還是不太理解為什么我只寫了兩個測試方法,Tests run卻顯示了3。


    (三) 轉
    Android下使用JUnit
    Andorid下使用Junit測試框架,是步入正規的Androdid開發的必經之路,在Junit中可以得到組件,可以模擬發送事件,檢測程序處理的正確性,下面就開始我們的教程: 
    工具:
    1、Android1.5 SDK
    2、ADT  0.9
    3、Eclipse
    需要的知識
    1、 Android開發的基礎
    2、Junit的基礎
    一、
    首先建立工程:
    目錄:
    選中的test source folder是測試類的包,包名隨便,但是在配置Manifest.xml要注意
    二、配置\layout\main.xml文件,加入兩個button組件,代碼如下:
      
    Java代碼 復制代碼 收藏代碼
    1. * <?xml version="1.0" encoding="utf-8"?>   
    2.    * <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
    3.    * android:orientation="vertical" android:layout_width="fill_parent"  
    4.    * android:layout_height="fill_parent">   
    5.    * <Button android:text="Button01" android:id="@+id/Button01"  
    6.    *   android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>   
    7.    * <Button android:text="Button02" android:id="@+id/Button02"  
    8.    *   android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>   
    9.    * </LinearLayout>  
    ...

    熱門標簽

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>