{"action":"opened","issue":{"url":"https://api.github.com/repos/SchibstedSpain/Barista/issues/116","repository_url":"https://api.github.com/repos/SchibstedSpain/Barista","labels_url":"https://api.github.com/repos/SchibstedSpain/Barista/issues/116/labels{/name}","comments_url":"https://api.github.com/repos/SchibstedSpain/Barista/issues/116/comments","events_url":"https://api.github.com/repos/SchibstedSpain/Barista/issues/116/events","html_url":"https://github.com/SchibstedSpain/Barista/issues/116","id":248254830,"number":116,"title":"Avoid calling the FailureHandler for expected errors","user":{"login":"Sloy","id":545251,"avatar_url":"https://avatars1.githubusercontent.com/u/545251?v=4","gravatar_id":"","url":"https://api.github.com/users/Sloy","html_url":"https://github.com/Sloy","followers_url":"https://api.github.com/users/Sloy/followers","following_url":"https://api.github.com/users/Sloy/following{/other_user}","gists_url":"https://api.github.com/users/Sloy/gists{/gist_id}","starred_url":"https://api.github.com/users/Sloy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sloy/subscriptions","organizations_url":"https://api.github.com/users/Sloy/orgs","repos_url":"https://api.github.com/users/Sloy/repos","events_url":"https://api.github.com/users/Sloy/events{/privacy}","received_events_url":"https://api.github.com/users/Sloy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-08-06T15:47:38Z","updated_at":"2017-08-06T15:47:38Z","closed_at":null,"body":"Barista does lots of magic tricks and we love that. But one of those tricks is to rely on `try/catch` patterns to allow higher level tests.\r\n\r\nThis has one big drawback: Espresso's [FailureHandler](https://developer.android.com/reference/android/support/test/espresso/FailureHandler.html) get's invoked every time, **even when the thrown exception is catched and ignored**.\r\n\r\nUsually it's not a big deal, but when using custom FailureHandlers to do things like taking a screenshot when a test fails, it becomes a real pain. You can't tell when there was an actual error and when it's just a \"ghost error\" from Barista.\r\n\r\n## Proposal\r\nMy proposal is to use the `withFailureHandler()` method on all Barista \"magic\" methods to override the global FailureHandler and avoid invoking it.\r\n\r\n## Discussion\r\nBut there's something I'm not sure about. From the test perspective, what should happen when a 3-attempts test fails? The global FailureHandler should be notified somehow (to take the screenshot, for example). But it takes two parameters, a `Throwable` and a `Matcher<View>`. Since Barista usually tries with multiple matchers, which one should we use? Any of them? The simplest one? A fake one? \r\n\r\nI would love to hear some opinions, and see if we can find a good solution.\r\n"}}
{"actor":{"display_login":"Sloy"}}