Say Hello的测试类及结果
Posted ZHANGXUJUN
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Say Hello的测试类及结果相关的知识,希望对你有一定的参考价值。
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的测试类及结果的主要内容,如果未能解决你的问题,请参考以下文章