qileilove

          blog已經(jīng)轉(zhuǎn)移至github,大家請(qǐng)?jiān)L問 http://qaseven.github.io/

          Android單元測(cè)試框架 Robolectric

           Android開發(fā)者們注意了,這款測(cè)試框架一定會(huì)讓你們興奮不已,因?yàn)樗且豢钜鸦旧蠑[脫了模擬器測(cè)試的老套路的速率單元測(cè)試框架Robolectric可以解壓Android SDK,還能直接對(duì)應(yīng)用進(jìn)行測(cè)試,從而幫你輕而易舉地解決所遇到的任何問題。
            Robolectric 是一款A(yù)ndroid單元測(cè)試框架,示例代碼:
          @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) 評(píng)論(0)  編輯  收藏 所屬分類: android

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

          導(dǎo)航

          統(tǒng)計(jì)

          常用鏈接

          留言簿(55)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 刚察县| 彩票| 博兴县| 襄樊市| 深圳市| 抚顺县| 如皋市| 德钦县| 郑州市| 噶尔县| 仁布县| 金沙县| 平罗县| 沧州市| 滦南县| 耒阳市| 盐城市| 枝江市| 诏安县| 岢岚县| 太仓市| 太谷县| 萨迦县| 湄潭县| 阜阳市| 双城市| 洛扎县| 德化县| 堆龙德庆县| 南丹县| 自贡市| 贺兰县| 邵武市| 保靖县| 文安县| 潞城市| 星子县| 东乡县| 兴宁市| 资中县| 舞钢市|