{"id":4283,"date":"2014-03-30T09:41:02","date_gmt":"2014-03-30T09:41:02","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/better-android-automated-test-performance-using-expresso-collection-of-common-programming-errors\/"},"modified":"2014-03-30T09:41:02","modified_gmt":"2014-03-30T09:41:02","slug":"better-android-automated-test-performance-using-expresso-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/better-android-automated-test-performance-using-expresso-collection-of-common-programming-errors\/","title":{"rendered":"Better Android Automated Test Performance using Expresso?-Collection of common programming errors"},"content":{"rendered":"<p>I stumbled upon Espresso after researching automated testing frameworks for Android. It seemed to have everything that I wanted: reliable tests, minimal boilerplate code, increased performance.<\/p>\n<p>I watched the GTAC 2013 presentation(s) demoing Espresso and was very excited to see how fast it ran the tests. Having actually implemented some tests, however, I must say that I don&#8217;t notice much, if any performance benefit over using the standard Android testing framework. I have not done any sort of &#8220;official&#8221; benchmarking, but it was my understanding that Espresso blew away the standard Android testing framework.<\/p>\n<p>The project that I am testing is the one described in the tutorial on developer.android.com. The tests that I am writing are very simple:<\/p>\n<pre><code>@Test\npublic void test_sendButton_shouldInitiallyBeDisabled() {\n    onView(withId(R.id.button_send)).check(matches(not(ViewMatchers.isEnabled())));\n}\n\n@Test\npublic void test_sendButton_shouldBeEnabledAfterEnteringText() {\n    String enteredText = \"This is my message!\";\n    \/\/ Type Text \n    onView(withId(R.id.edit_message)).perform(ViewActions.typeText(enteredText));\n\n    \/\/ Validate the Result\n    onView(withId(R.id.button_send)).check(matches(ViewMatchers.isEnabled()));\n}\n\n@Test\npublic void test_enteringTextAndPressingSendButton_shouldDisplayEnteredText() {\n    String enteredText = \"This is my message!\";\n    \/\/ Type Text \n    onView(withId(R.id.edit_message)).perform(ViewActions.typeText(enteredText));\n\n    \/\/ Click Button\n    onView(withId(R.id.button_send)).perform(click());\n\n    \/\/ Validate the Results\n    onView(withId(R.id.display_message)).check(ViewAssertions.matches(ViewMatchers.withText(enteredText)));\n}\n<\/code><\/pre>\n<p>I followed all the instructions on the Espresso website, paying particularly close attention that my Run Configuration used the GoogleInstrumentationTestRunner.<\/p>\n<p>So what am I missing? Did I just miss something simple? Or is my premise about significantly improved performance completely wrong?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I stumbled upon Espresso after researching automated testing frameworks for Android. It seemed to have everything that I wanted: reliable tests, minimal boilerplate code, increased performance. I watched the GTAC 2013 presentation(s) demoing Espresso and was very excited to see how fast it ran the tests. Having actually implemented some tests, however, I must say [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4283","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4283","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4283"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4283\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}