<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Support library &#8211; Wiebe Elsinga</title>
	<atom:link href="http://wiebe-elsinga.com/blog/tag/support-library/feed/" rel="self" type="application/rss+xml" />
	<link>http://wiebe-elsinga.com/blog</link>
	<description>Blog</description>
	<lastBuildDate>Mon, 16 Feb 2015 10:35:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.1</generator>
	<item>
		<title>Android Testing Support Library announced</title>
		<link>http://wiebe-elsinga.com/blog/android-testing-support-library-announced/</link>
					<comments>http://wiebe-elsinga.com/blog/android-testing-support-library-announced/#comments</comments>
		
		<dc:creator><![CDATA[W.Elsinga]]></dc:creator>
		<pubDate>Mon, 03 Nov 2014 03:39:42 +0000</pubDate>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Functional testing]]></category>
		<category><![CDATA[Support library]]></category>
		<guid isPermaLink="false">http://wiebe-elsinga.com/blog/?p=1608</guid>

					<description><![CDATA[During the Droidcon UK 2014, Stephan Linzner of Google announced the upcoming Android Testing Support Library. This means Google is (finally) taking testing Android apps seriously. The library is a unbundled static testing library for Android that containers all Android testing frameworks by Google. It will become a available through the Android Support repository and as open source in AOSP. So what does it contain? AndroidJUnitRunner This Runner, based on android.test.InstrumentationTestRunner, runs JUnit3 and JUnit4 tests against an Android package (application). Let me give an example: @RunWith &#40;JUnit4.class&#41; public class MyJUnit4Test &#123; &#123; &#160; Droidcon mDroidconUK; &#160; &#160; @Before &#160; public void setUp&#40;&#41; &#123; &#160; &#160; mDroidconUK = new Droidcons.get&#40;Droidcon.UK&#41;; &#160; &#160; mDroidconUK.open&#40;&#41;; &#160; &#125; &#160; @Test &#160; public void checkPreconditions&#40;&#41; &#123; &#160; &#160; assertNotNull&#40;&#34;mDroidconUK cannot be null&#34;, mDroidconUK&#41;; &#160; &#125; &#160; @After &#160; public void tearDown&#40;&#41; &#123; &#160; &#160; mDroidconUK.close&#40;&#41;; &#160; &#125; &#125; Espresso Introduced at the GTAC in 2013, Espresso makes it possible to write concise, beautiful, and reliable Android UI tests quickly. Lets look at some examples: // Find view using a Matcher and type text using a ViewAction onView&#40;withId&#40;R.id.message_edit_text&#41;&#41;.perform&#40;typeText&#40;TEXT_MESSAGE&#41;, closeSoftKeyboard&#40;&#41;&#41;; // Perform a click ViewAction onView&#40;withId&#40;R.id.send_button&#41;&#41;.perform&#40;click&#40;&#41;&#41;; // Verify using a ViewAssertion onView&#40;withId&#40;R.id.received_message_text_view&#41;&#41;.check&#40;matches&#40;withText&#40;&#40;TEXT_MESSAGE&#41;&#41;&#41;&#41;; Intento Intento is like Mockito but for Intents. Basically a mock framework that allows you to create and configure mock objects. Let me give you an example: public void testDailerInput_typeNumberAndCall&#40;&#41; &#123; &#160; &#160; //Type phonenumber in dialer &#160; onView&#40;withId&#40;R.id.send_data_to_call_edit_text&#41;&#41;.perform&#40;scrollTo&#40;&#41;, typeText&#40;&#34;123-345-6789&#34;&#41;, closeSoftKeyboard&#40;&#41;&#41;; &#160; &#160; // Click the call button &#160; onView&#40;withId&#40;R.id.send_to_call_button&#41;&#41;.perform&#40;scrollTo&#40;&#41;, click&#40;&#41;&#41;; &#160; &#160; //Validate Intent has been send &#160; intended&#40;allOf&#40; &#160; &#160; &#160; hasAction&#40;Intent.ACTION_CALL&#41;, &#160; &#160; &#160; toPackage&#40;&#34;com.android.phone&#34;&#41;, &#160; &#160; &#160; hasData&#40;allOf&#40;hasSchemaSpecificPart&#40;&#34;tel&#34;, &#34;123-345-6789&#34;&#41;&#41;&#41;&#41;, &#160; &#160; &#160; times&#40;1&#41;&#41;; &#125; In conclusion: Testing with Android is finally becoming a more prominent part of Android Development cycle with the introduction of the Android Testing Support Library]]></description>
										<content:encoded><![CDATA[<p>During the <a href="http://uk.droidcon.com/2014/" title="Droidcon UK 2014" target="_blank">Droidcon UK 2014</a>, <a href="https://plus.google.com/+StephanLinzner" title="StephanLinzner G+ Profile" target="_blank">Stephan Linzner</a> of Google announced the upcoming Android Testing Support Library. This means Google is (finally) taking testing Android apps seriously. </p>
<p>The library is a unbundled static testing library for Android that containers all Android testing frameworks by Google. It will become a available through the Android Support repository and as open source in AOSP.</p>
<p>So what does it contain?</p>
<ul>
<li><em><strong>AndroidJUnitRunner</strong></em><br />
This Runner, based on <em>android.test.InstrumentationTestRunner</em>, runs <em>JUnit3</em> and <em>JUnit4</em> tests against an Android package (application). Let me give an example:</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:100%;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@RunWith <span style="color: #009900;">&#40;</span>JUnit4.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MyJUnit4Test <span style="color: #009900;">&#123;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; Droidcon mDroidconUK<span style="color: #339933;">;</span><br />
&nbsp;<br />
&nbsp; @Before <br />
&nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setUp<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; mDroidconUK <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Droidcons.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>Droidcon.<span style="color: #006633;">UK</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; mDroidconUK.<span style="color: #006633;">open</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; @Test <br />
&nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> checkPreconditions<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; assertNotNull<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;mDroidconUK cannot be null&quot;</span>, mDroidconUK<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; @After <br />
&nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> tearDown<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; mDroidconUK.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>
</li>
<li><em><strong>Espresso</strong></em><br />
Introduced at the GTAC in 2013, Espresso makes it possible to write concise, beautiful, and reliable Android UI tests quickly. Lets look at some examples:</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #666666; font-style: italic;">// Find view using a Matcher and type text using a ViewAction</span><br />
onView<span style="color: #009900;">&#40;</span>withId<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">message_edit_text</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">perform</span><span style="color: #009900;">&#40;</span>typeText<span style="color: #009900;">&#40;</span>TEXT_MESSAGE<span style="color: #009900;">&#41;</span>, closeSoftKeyboard<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Perform a click ViewAction</span><br />
onView<span style="color: #009900;">&#40;</span>withId<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">send_button</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">perform</span><span style="color: #009900;">&#40;</span>click<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Verify using a ViewAssertion</span><br />
onView<span style="color: #009900;">&#40;</span>withId<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">received_message_text_view</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">check</span><span style="color: #009900;">&#40;</span>matches<span style="color: #009900;">&#40;</span>withText<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>TEXT_MESSAGE<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>
</li>
<li><em><strong>Intento</strong></em><br />
Intento is like Mockito but for Intents. Basically a mock framework that allows you to create and configure mock objects. Let me give you an example:</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testDailerInput_typeNumberAndCall<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; <br />
&nbsp; <span style="color: #666666; font-style: italic;">//Type phonenumber in dialer</span><br />
&nbsp; onView<span style="color: #009900;">&#40;</span>withId<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">send_data_to_call_edit_text</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">perform</span><span style="color: #009900;">&#40;</span>scrollTo<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, typeText<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;123-345-6789&quot;</span><span style="color: #009900;">&#41;</span>, closeSoftKeyboard<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <br />
&nbsp; <span style="color: #666666; font-style: italic;">// Click the call button</span><br />
&nbsp; onView<span style="color: #009900;">&#40;</span>withId<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">send_to_call_button</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">perform</span><span style="color: #009900;">&#40;</span>scrollTo<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, click<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <br />
&nbsp; <span style="color: #666666; font-style: italic;">//Validate Intent has been send</span><br />
&nbsp; intended<span style="color: #009900;">&#40;</span>allOf<span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; hasAction<span style="color: #009900;">&#40;</span>Intent.<span style="color: #006633;">ACTION_CALL</span><span style="color: #009900;">&#41;</span>,<br />
&nbsp; &nbsp; &nbsp; toPackage<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;com.android.phone&quot;</span><span style="color: #009900;">&#41;</span>,<br />
&nbsp; &nbsp; &nbsp; hasData<span style="color: #009900;">&#40;</span>allOf<span style="color: #009900;">&#40;</span>hasSchemaSpecificPart<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;tel&quot;</span>, <span style="color: #0000ff;">&quot;123-345-6789&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>,<br />
&nbsp; &nbsp; &nbsp; times<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
</li>
</ul>
<p>
<strong>In conclusion</strong>: Testing with Android is finally becoming a more prominent part of Android Development cycle with the introduction of the Android Testing Support Library</p>
]]></content:encoded>
					
					<wfw:commentRss>http://wiebe-elsinga.com/blog/android-testing-support-library-announced/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
