qileilove

          blog已經轉移至github,大家請訪問 http://qaseven.github.io/

          Android單元測試框架 Robolectric

           Android開發者們注意了,這款測試框架一定會讓你們興奮不已,因為它是一款已基本上擺脫了模擬器測試的老套路的速率單元測試框架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 閱讀(467) 評論(0)  編輯  收藏 所屬分類: android

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

          導航

          統計

          常用鏈接

          留言簿(55)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 峨眉山市| 象山县| 张家港市| 甘孜县| 西畴县| 海盐县| 澎湖县| 美姑县| 蕲春县| 绥德县| 长顺县| 广平县| 西林县| 日土县| 和顺县| 德清县| 宣城市| 焦作市| 高安市| 邵武市| 河曲县| 黔南| 内丘县| 禄丰县| 昌宁县| 海宁市| 甘肃省| 广德县| 洛南县| 中山市| 古交市| 红河县| 清流县| 双桥区| 闵行区| 万全县| 渑池县| 泰兴市| 宁远县| 临海市| 浮梁县|