딥 링크 테스트를 위해 에스프레소 스크립트를 작성하고 시작하는 방법을 모르겠다. 더 많은 아이디어를 얻을 수있는 솔루션을 찾고, 시작하는 방법에 대한 단계별 절차를 단계별로 안내하십시오.android espresso를 사용한 딥 링크 자동화
예 : 모바일 사용자를 대상으로해야하는 사용자를 두드리는 Gmail 링크가있는 시나리오를 찾고 있습니다. 에스프레소를 사용하여 어떻게 테스트 할 수 있습니까?
미리 감사드립니다. 활동 규칙
딥 링크 테스트를 위해 에스프레소 스크립트를 작성하고 시작하는 방법을 모르겠다. 더 많은 아이디어를 얻을 수있는 솔루션을 찾고, 시작하는 방법에 대한 단계별 절차를 단계별로 안내하십시오.android espresso를 사용한 딥 링크 자동화
예 : 모바일 사용자를 대상으로해야하는 사용자를 두드리는 Gmail 링크가있는 시나리오를 찾고 있습니다. 에스프레소를 사용하여 어떻게 테스트 할 수 있습니까?
미리 감사드립니다. 활동 규칙
시작은 다음
@Rule
public ActivityTestRule<YourAppMainActivity> mActivityRule =
new ActivityTestRule<>(YourAppMainActivity.class, true, false);
당신은 뭔가 링크에서 URI를 구문 분석하고 의도
를 시작하는 당신이 원하는 그런 활동 규칙을 의도String uri = "http://your_deep_link_from_gmail";
private Intent getDeepLinkIntent(String uri){
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse(uri))
.setPackage(getTargetContext().getPackageName());
return intent;
}
을 반환하려면
Intent intent = getDeepLinkIntent(deepLinkUri);
mActivityRule.launchActivity(intent);
글쎄 IntentTestRule
이 제대로 작동하지 않습니다.
public ActivityTestRule<MyActivity> activityTestRule = new ActivityTestRule<MyActivity>(MyActivity.class, false, false);
을 그리고 나는 적절한 UI 단위 테스트는이 같은 것으로 쓸 것 : 그래서 나는 ActivityTestRule
와 같이하려고합니다
@Test
public void testDeeplinkingFilledValue(){
Intent intent = new Intent(InstrumentationRegistry.getInstrumentation()
.getTargetContext(), MyActivity.class);
Uri data = new Uri.Builder().appendQueryParameter("clientName", "Client123").build();
intent.setData(data);
Intents.init();
activityTestRule.launchActivity(intent);
intended(allOf(
hasComponent(new ComponentName(getTargetContext(), MyActivity.class)),
hasExtras(allOf(
hasEntry(equalTo("clientName"), equalTo("Client123"))
))));
Intents.release();
}
당신이 딥 링크하는지 테스트 예정이로 지정된 쿼리 매개 변수가 실제로 딥 링크에 대한 의도를 처리하는 활동에 의해 올바르게 검색되고 있습니다.
[Android에서 딥 링크 테스트 작성 방법] 가능한 복제본 (https://stackoverflow.com/questions/42951216/how-to-write-tests-for-deep-links-in-android) – Ixx