qileilove

          blog已經(jīng)轉(zhuǎn)移至github,大家請訪問 http://qaseven.github.io/

          Android單元測試框架 Robolectric

           Android開發(fā)者們注意了,這款測試框架一定會讓你們興奮不已,因為它是一款已基本上擺脫了模擬器測試的老套路的速率單元測試框架Robolectric可以解壓Android SDK,還能直接對應用進行測試,從而幫你輕而易舉地解決所遇到的任何問題。
            Robolectric 是一款Android單元測試框架,示例代碼:
          @RunWith(RobolectricTestRunner.class)
          public class MyActivityTest {
          @Test
          public void clickingButton_shouldChangeResultsViewText() throws Exception {
          Activity activity = Robolectric.buildActivity(MyActivity.class).create().get();
          Button pressMeButton = (Button) activity.findViewById(R.id.press_me_button);
          TextView results = (TextView) activity.findViewById(R.id.results_text_view);
          pressMeButton.performClick();
          String resultsText = results.getText().toString();
          assertThat(resultsText, equalTo("Testing Android Rocks!"));
          }
          }

          posted on 2014-12-23 00:08 順其自然EVO 閱讀(465) 評論(0)  編輯  收藏 所屬分類: android

          <2014年12月>
          30123456
          78910111213
          14151617181920
          21222324252627
          28293031123
          45678910

          導航

          統(tǒng)計

          常用鏈接

          留言簿(55)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 称多县| 班戈县| 海原县| 乐安县| 清水河县| 华容县| 盱眙县| 宜都市| 长丰县| 喀喇沁旗| 永年县| 酒泉市| 星子县| 保康县| 开江县| 阳高县| 楚雄市| 台北县| 集安市| 江永县| 唐海县| 景谷| 彩票| 中超| 永昌县| 多伦县| 莫力| 银川市| 渭南市| 胶南市| 偏关县| 阜城县| 岢岚县| 黄梅县| 贡觉县| 修武县| 宁夏| 隆林| 务川| 英山县| 北京市|