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 閱讀(465) 評論(0)  編輯  收藏 所屬分類: android

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

          導航

          統計

          常用鏈接

          留言簿(55)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 贡觉县| 嘉鱼县| 阳山县| 邵武市| 和静县| 鹤岗市| 博野县| 建水县| 金阳县| 华阴市| 河南省| 屯昌县| 华蓥市| 新宾| 长垣县| 仪陇县| 和田市| 军事| 游戏| 珲春市| 宜昌市| 洛浦县| 得荣县| 邛崃市| 秭归县| 高邮市| 股票| 舞阳县| 双辽市| 客服| 会同县| 顺昌县| 泾阳县| 英山县| 庄河市| 五家渠市| 齐河县| 福海县| 丽水市| 开江县| 革吉县|