Code for KOSEN meetup #3
- 22. UI テスト
・ViewMatcher で View を指定して
・ViewAction で View を操作して
・ViewAssertion で View の状態を確認する
Espresso による UI テスト?
- 24. UI テスト
サンプル(続)
@Before
public void setUp() throws Exception {
super.setUp();
injectInstrumentation(InstrumentationRegistry
.getInstrumentation());
mActivity = getActivity();
}
@After
public void tearDown() throws Exception {
super.tearDown();
}
- 25. UI テスト
サンプル(続)
@Before
public void setUp() throws Exception {
super.setUp();
injectInstrumentation(InstrumentationRegistry
.getInstrumentation());
mActivity = getActivity();
}
@After
public void tearDown() throws Exception {
super.tearDown();
}
オブジェクトのリークを回避
- 26. UI テスト
サンプル(続)
@Test
public void testHoge(){
Espresso.onView(ViewMatchers.withId(R.id.text_hoge))
.check(ViewAssertions
.matches(ViewMatchers.withText("Test")));
}
- 29. あ り が と う ご ざ い ま し た