0
Android에서이 클래스를 테스트하여 실제로 전자 메일 보낸 사람 앱 선택기가 열리는 것을 확인하고 응용 프로그램을 선택하면 필드가 미리 채워지고 파일이 첨부됩니다.어떻게이 클래스를 Android에서 단위 테스트 할 수 있습니까?
UI를 통해 단위 테스트 또는 통합 테스트 또는 자동 테스트를 수행해야합니까? 설정 내가 필요로 할 어떻게 내가 분리 만이 클래스를 테스트 할 수 있습니다 어떤 종류의 : 당신은 Robolectric의 도움으로이 테스트 장치를 시도 할 수 있습니다
public class EmailSender {
public static void sendEmailWithAttachment(Context context,
String[] recipient,
String subject,
String attachmentFilePath) {
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent .setType("vnd.android.cursor.dir/email");
emailIntent .putExtra(Intent.EXTRA_EMAIL, recipient);
emailIntent .putExtra(Intent.EXTRA_STREAM, attachmentFilePath);
emailIntent .putExtra(Intent.EXTRA_SUBJECT, subject);
context.startActivity(Intent.createChooser(emailIntent , "Send email..."));
}
}
참조 할 수 있지만 https://developer.android.com (당신이 UI 자동화와 같은 다른 도구를 사용한다고 생각합니다 /training/testing/ui-testing/uiautomator-testing.html) 또는 Robolectric과 같은 것에 대해서는 Neh가 썼습니다. – jeprubio