1、Android Testing Gemini About Me Gemini ? SegmentFault for Android ? SegmentFault ? Android ? ?engine.io ? ? ? ? Mockito Dagger CI? ? ?. ? ?Unit Test? ? UI ? UI? ? ? ? ? ? ? ? ?100% int add (int a, int b) return a + b; assertEquals(add(1,2), 3 ); ? ? ? ? ? void job1(); void job2(); int job3(); assert
2、Equals(job3_result, job3(); UI? ? ? ? ? Android Testing Framework Espresso Test public void greeterSaysHello() onView(withId(R.id.name_fi eld) .perform(typeText(“Steve“); onView(withId(R.id.greet_button) .perform(click(); onView(withText(“Hello Steve!“) .check(matches(isDisplayed(); UI? UI? UI? ? ?
3、? ? void business() callback IdleResource By Espresso Idle Resource Override boolean isIdleNow(); ResourceCallback.onTransitionToIdle(); okhttp3-idleresource Mock Mock Object Mock Http ? Mockito ?model?UI? ?model? Test public void test1() / ? mock MyClass test = Mockito.mock(MyClass.class); / ? getU
4、niqueId() ? when(test.getUniqueId().thenReturn(43); / ?mock? assertEquals(test.getUniqueId(), 43); OkHttp MockWebServer ?Mock Object? Dagger2 ?DI? Dagger Components Module ? Component ? Inject ? Module ?Source1? Component Module ?Source2? Inject App with inject point Components Module TestModule Dagger Management User Store Database Instance (SQLite) Retrofi t Instance Gitlab CI ? TDD ? ? ? Thanks!