码迷,mamicode.com
首页 > 其他好文 > 详细

Say Hello的测试类及结果

时间:2017-03-17 15:01:28      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:for   form   hello   color   .com   image   keyboard   match   alt   

public class MainActivityInstrumentationTest {
    private static final String STRING_TO_BE_TYPED = "peter";

    @Rule
    public ActivityTestRule<MainActivity> mainActivityRule = new ActivityTestRule<>(MainActivity.class);

    @Test
    public void sayHello(){
        onView(withId(R.id.name)).perform(typeText(STRING_TO_BE_TYPED), ViewActions.closeSoftKeyboard());
        onView(withText("SAY HELLO")).perform(click());
        String expectedText = "Hello,"+STRING_TO_BE_TYPED+"!";
        onView(withId(R.id.text)).check(matches(withText(expectedText)));
    }
}

技术分享

Say Hello的测试类及结果

标签:for   form   hello   color   .com   image   keyboard   match   alt   

原文地址:http://www.cnblogs.com/ChinaJun/p/6565557.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!