Assigned
Status Update
Comments
ku...@google.com <ku...@google.com>
ku...@google.com <ku...@google.com> #2
Do you have a repro project that you could share with us?
There should be no need to excluding any dependencies: we automatically remove them from the test APK if they are in the main APK.
There should be no need to excluding any dependencies: we automatically remove them from the test APK if they are in the main APK.
pa...@gmail.com <pa...@gmail.com> #3
What exact issue you are facing?
Cannot verify that an Espresso failure is coming from espresso via EspressoException.
What steps are needed to reproduce this issue?
Write a unit test that catches the exceptions coming from onView(customMatcher()) and verifies they are EspressoException (i.e. not NullPointer or IndexOutOfBounds) to validate that the custom matcher is working, but does not match.
try {
onView(customMatcher()).perform(click());
fail("should have failed to match / perform");
} catch(Throwable ex) {
assertThat(ex, instanceOf(EspressoException.class));
}
for more please read OP
What is the expected output? my tests pass
What is the current output? my tests fail
Cannot verify that an Espresso failure is coming from espresso via EspressoException.
What steps are needed to reproduce this issue?
Write a unit test that catches the exceptions coming from onView(customMatcher()) and verifies they are EspressoException (i.e. not NullPointer or IndexOutOfBounds) to validate that the custom matcher is working, but does not match.
try {
onView(customMatcher()).perform(click());
fail("should have failed to match / perform");
} catch(Throwable ex) {
assertThat(ex, instanceOf(EspressoException.class));
}
for more please read OP
What is the expected output? my tests pass
What is the current output? my tests fail
ku...@google.com <ku...@google.com> #4
Thank you for the reply.
Can you please provide android bug report/logs of the issue.
logcat output
Seehttp://developer.android.com/tools/help/logcat.html . Copy and paste relevant sections of the logcat output into this issue.
Can you please provide android bug report/logs of the issue.
logcat output
See
pa...@gmail.com <pa...@gmail.com> #5
It is a software design issue, there's no real bug/crash behind it. All I'm looking for is for
AssertionFailedWithCauseError ex = ...
assert ex instanceof EspressoException;
to pass, because it is an exception coming from Espresso.
AssertionFailedWithCauseError ex = ...
assert ex instanceof EspressoException;
to pass, because it is an exception coming from Espresso.
ku...@google.com <ku...@google.com> #6
Thank you for reporting this issue. We have shared this with our product and engineering team and will update this issue with more information as it becomes available.
am...@google.com <am...@google.com>
cc...@google.com <cc...@google.com>
cc...@google.com <cc...@google.com>
ae...@google.com <ae...@google.com> #7
This has not been updated in over 1 year so is being closed. Please reopen as neccesary.
pa...@gmail.com <pa...@gmail.com> #8
I'm not sure why this issue is here and not in the android-test GitHub repo (probably at the time the GitHub repo didn't exist). The issue is still valid to this day. Making an informed decision on adding an interface to a class shouldn't take 5 years, however low priority... Can you please tag @brettchabot to weigh in as he seems to be the owner of Espresso (at least externally).
Description
Version used: 2.2.2
I have some custom matchers and I'm trying to write some integration tests for them using Espresso. I'm trying to utilize JUnit 4's assertThrows for checking for failures:
//setup
EspressoException expectedFailure = assertThrows(EspressoException.class, new ThrowingRunnable() {
@Override public void run() {
//onView(customMatcher())...
}
});
//verification of failure
I don't really care in what way Espresso fails as long as it contains my matcher's error message, but the signature of assertThrows doesn't allow me to catch if the failure is:
android.support.test.espresso.base.DefaultFailureHandler$AssertionFailedWithCauseError: 'my matcher description' doesn't match the selected view.