{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/buck/issues/305","labels_url":"https://api.github.com/repos/facebook/buck/issues/305/labels{/name}","comments_url":"https://api.github.com/repos/facebook/buck/issues/305/comments","events_url":"https://api.github.com/repos/facebook/buck/issues/305/events","html_url":"https://github.com/facebook/buck/issues/305","id":76867354,"number":305,"title":"Android Instrumentation Tests","user":{"login":"tgummerer","id":191004,"avatar_url":"https://avatars.githubusercontent.com/u/191004?v=3","gravatar_id":"","url":"https://api.github.com/users/tgummerer","html_url":"https://github.com/tgummerer","followers_url":"https://api.github.com/users/tgummerer/followers","following_url":"https://api.github.com/users/tgummerer/following{/other_user}","gists_url":"https://api.github.com/users/tgummerer/gists{/gist_id}","starred_url":"https://api.github.com/users/tgummerer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgummerer/subscriptions","organizations_url":"https://api.github.com/users/tgummerer/orgs","repos_url":"https://api.github.com/users/tgummerer/repos","events_url":"https://api.github.com/users/tgummerer/events{/privacy}","received_events_url":"https://api.github.com/users/tgummerer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/buck/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-05-15T21:43:15Z","updated_at":"2015-05-30T09:01:41Z","closed_at":null,"body":"Hi,\r\n\r\nI've recently started exploring buck for android applications.  I've tried searching through the documentation, but couldn't find a mention of it anywhere.  Is there any support to run Android Instrumentation Tests from Buck?\r\n\r\nRegards,\r\nThomas"},"comment":{"url":"https://api.github.com/repos/facebook/buck/issues/comments/107014858","html_url":"https://github.com/facebook/buck/issues/305#issuecomment-107014858","issue_url":"https://api.github.com/repos/facebook/buck/issues/305","id":107014858,"user":{"login":"tgummerer","id":191004,"avatar_url":"https://avatars.githubusercontent.com/u/191004?v=3","gravatar_id":"","url":"https://api.github.com/users/tgummerer","html_url":"https://github.com/tgummerer","followers_url":"https://api.github.com/users/tgummerer/followers","following_url":"https://api.github.com/users/tgummerer/following{/other_user}","gists_url":"https://api.github.com/users/tgummerer/gists{/gist_id}","starred_url":"https://api.github.com/users/tgummerer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgummerer/subscriptions","organizations_url":"https://api.github.com/users/tgummerer/orgs","repos_url":"https://api.github.com/users/tgummerer/repos","events_url":"https://api.github.com/users/tgummerer/events{/privacy}","received_events_url":"https://api.github.com/users/tgummerer/received_events","type":"User","site_admin":false},"created_at":"2015-05-30T09:01:41Z","updated_at":"2015-05-30T09:01:41Z","body":"Thanks!  I also found ```android_instrumentation_apk()```, which seems to work.\r\n\r\nI did however run into a few issues trying to run the tests.  I'm trying to use the android test kit, and get the following exception when trying to run the tests via adb:\r\n```\r\njava.lang.NoClassDefFoundError: android.support.test.espresso.matcher.ViewMatchers$12\r\n\tat android.support.test.espresso.matcher.ViewMatchers.withId(ViewMatchers.java:393)\r\n\tat com.wueventapp.apso.activity.MainActivityTest.testSearchButtonIsShown(MainActivityTest.java:47)\r\n\tat java.lang.reflect.Method.invokeNative(Native Method)\r\n\tat android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)\r\n\tat android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)\r\n\tat android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)\r\n\tat android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)\r\n\tat android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)\r\n\tat android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:545)\r\n\tat android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1551)\r\n```\r\n\r\nI'm not sure what I'm missing.\r\n\r\nI also tried to use AndroidJUnitRunner for running the tests, but android seems to be unable to find it, even though I included it as dependency for ```android_instrumentation_apk()```.  I also tried with ```android_binary()``` with the same result, getting the following error:\r\n\r\n```\r\nINSTRUMENTATION_RESULT: shortMsg=java.lang.ClassNotFoundException\r\nINSTRUMENTATION_RESULT: longMsg=java.lang.ClassNotFoundException: android.support.test.runner.AndroidJUnitRunner\r\nINSTRUMENTATION_CODE: 0\r\n```\r\n\r\nI'm also trying to implement support for a test rule for instrumentation tests, so they can be fully integrated with ```buck test``` but that might still take some time, as I have limited time available to do that."}}