2
나는 내가 편집 텍스트를 클릭하면 텍스트를 삽입하고 키보드를 닫 다시 누르면하고 내 테스트에서Android Espresso : 테스트가 실패하면 내 로그 출력을 어떻게 추가합니까?
public static final String[] WRONG_VALUES = {"1000","4000","2000"};
잘못 간주되는 값의 배열을 가지고있다. 다음
onView(withId(R.id.inputField)).perform(click(), replaceText(text), pressBack());
시험은 내가 실패 않기 때문에 때 실패 값을 기록 오류보기이이 작동
onView(withId(R.id.error)).matches(not(isCompletelyDisplayed()));
을 보여주는되어 있는지 확인하지만 테스트 어딘가에 출력을 싶습니다 어느 값이 테스트되고 있는지 알 수 없음 이것이 가능합니까? 당신의 검사 결과가 실행되기 전에 생성,
public class CustomFailureHandler implements FailureHandler {
private final FailureHandler delegate;
public CustomFailureHandler(@NonNull Instrumentation instrumentation) {
delegate = new DefaultFailureHandler(instrumentation.getTargetContext());
}
@Override
public void handle(final Throwable error, final Matcher<View> viewMatcher) {
// Log anything you want here
// Then delegate the error handling to the default handler which will throw an exception
delegate.handle(error, viewMatcher);
}
}
와 같은 사용자 지정 오류 처리기 설정 :
감사
문제에 대해 더 자세히 알려주십시오. Android에서 모든 값을 기록하는 방법을 묻는 중입니까? –