<?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>Shaun ErvineShaun Ervine - Freelance software consultant</title>
	<atom:link href="http://shaune.com.au/feed/" rel="self" type="application/rss+xml" />
	<link>http://shaune.com.au</link>
	<description>Freelance software consultant</description>
	<lastBuildDate>Tue, 12 Feb 2013 03:24:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to stop iOS UIAutomation / Xcode Instruments from requesting developer tool access</title>
		<link>http://shaune.com.au/how-to-stop-ios-uiautomation-xcode-instruments-from-requesting-developer-tool-access/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-stop-ios-uiautomation-xcode-instruments-from-requesting-developer-tool-access</link>
		<comments>http://shaune.com.au/how-to-stop-ios-uiautomation-xcode-instruments-from-requesting-developer-tool-access/#comments</comments>
		<pubDate>Tue, 12 Feb 2013 03:23:36 +0000</pubDate>
		<dc:creator>Shaun</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[devtools]]></category>
		<category><![CDATA[devtoolsecurity]]></category>
		<category><![CDATA[instruments]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[uiautomation]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://shaune.com.au/?p=496</guid>
		<description><![CDATA[Out at my current client we are using jenkins as our CI environment which also launches our UIAutomation tests via Instruments CLI.  Recently in OS X it looks like apple tightened up the program security so that you will be prompted for something like&#8230; &#8220;Developer Tools Access is trying to take control of another process. [...]]]></description>
			<content:encoded><![CDATA[<p>Out at my current client we are using jenkins as our CI environment which also launches our UIAutomation tests via Instruments CLI.  Recently in OS X it looks like apple tightened up the program security so that you will be prompted for something like&#8230;</p>
<p><strong>&#8220;Developer Tools Access is trying to take control of another process. Type your password to allow this.&#8221;</strong></p>
<p><a href="http://shaune.com.au/wp-content/uploads/2013/02/blog-4.png"><img class="size-medium wp-image-499 alignnone" title="Developer Tools Access" src="http://shaune.com.au/wp-content/uploads/2013/02/blog-4-300x161.png" alt="" width="300" height="161" /></a></p>
<p><span id="more-496"></span>Open up a Terminal and try</p>
<p><strong>sudo /usr/sbin/DevToolsSecurity &#8211;enable</strong></p>
<p>Hopefully you end up with a console message along the lines of</p>
<p><strong>&#8220;Developer mode is now enabled.&#8221; </strong></p>
<p><strong></strong>This resolved the prompt issue for me &#8230;<a href="http://stackoverflow.com/a/9725547/786845"> thanks to kenster for his post on stackoverflow</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://shaune.com.au/how-to-stop-ios-uiautomation-xcode-instruments-from-requesting-developer-tool-access/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessibility / VoiceOver considerations when using multiple UIWindows in iOS applications</title>
		<link>http://shaune.com.au/accessibility-voiceover-considerations-when-using-multiple-uiwindows-in-ios-applications/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=accessibility-voiceover-considerations-when-using-multiple-uiwindows-in-ios-applications</link>
		<comments>http://shaune.com.au/accessibility-voiceover-considerations-when-using-multiple-uiwindows-in-ios-applications/#comments</comments>
		<pubDate>Thu, 07 Feb 2013 20:46:06 +0000</pubDate>
		<dc:creator>Shaun</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[UIAlertView]]></category>
		<category><![CDATA[UIWindow]]></category>
		<category><![CDATA[voiceover]]></category>

		<guid isPermaLink="false">http://shaune.com.au/?p=469</guid>
		<description><![CDATA[This post follows on from my previous post Using multiple UIWindows in iOS applications but I will cover the specific issue I encountered when VoiceOver mode is on. I have been working on an application that makes use of multiple UIWindows within its view heirachy, mostly because it is quite a secure application and so the [...]]]></description>
			<content:encoded><![CDATA[<p>This post follows on from my previous post <a title="Using multiple UIWindows in iOS applications" href="http://shaune.com.au/using-multiple-uiwindows-in-ios-applications/">Using multiple UIWindows in iOS applications</a> but I will cover the specific issue I encountered when VoiceOver mode is on.</p>
<p>I have been working on an application that makes use of multiple UIWindows within its view heirachy, mostly because it is quite a secure application and so the easiest way for us to block access to the app is to present a UIWindow above all other windows in the app.</p>
<h4><span id="more-469"></span></h4>
<h4>Happy day scenario (VoiceOver disabled):</h4>
<p>I am currently presenting a UIAlertView to the user and for whatever reason the app gets interrupted and goes into the background.  When this happens I put up our UIWindow (lets call it our security window) so you can no longer interact or see any part of the app, including the currently displayed alert.</p>
<p>When the user resumes the app from the background the security window is displayed and functions as expected.  We can dismiss it and low and behold our UIAlertView is there and we are all happy.</p>
<h4>Accessibility scenario (VoiceOver enabled):</h4>
<p>Same as before we present a UIAlertView to the user (accessibility does its thing and reads it out) and for whatever reason the app gets interrupted and goes into the background.  When this happens I put up our security window so you can no longer interact or see any part of the app, including the currently displayed alert.</p>
<p>Now when the user resumes the app from the background the security window is displayed and is interactive as expected however<em><strong> the UIAlertView that is displayed but not seen is actually read out</strong><strong>!!!</strong></em>  This is really annoying because you cant interact with that alert view and you can&#8217;t see it.</p>
<h4>My observations regarding how iOS handles UIAlertViews when VoiceOver is enabled</h4>
<p>It appears to me that regardless of the windowLevels you set on your windows, if you are displaying a UIAlertView anywhere in your app and you cover it with a UIWindow and resume from the background.  Apple take the initiative and assume that the UIAlertView is super important so they read it out using something like</p>
<p><strong style="font-size: 14px;">UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, &lt;Text from UIAlertView&gt;);</strong></p>
<p>even though you can not actually see the UIAlertView or interact with it for that matter!</p>
<p>Furthermore I noticed that when the app resumes from the background if there is any UIAlertView it will make it the keywindow whilst VoiceOver is running and once it has finished reading out the alert it is more than happy to resign itself again.</p>
<p>If anyone has any further insight into this issue drop me a line as I would be interested to know how if at all possible you managed to resolve this issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://shaune.com.au/accessibility-voiceover-considerations-when-using-multiple-uiwindows-in-ios-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using multiple UIWindows in iOS applications</title>
		<link>http://shaune.com.au/using-multiple-uiwindows-in-ios-applications/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-multiple-uiwindows-in-ios-applications</link>
		<comments>http://shaune.com.au/using-multiple-uiwindows-in-ios-applications/#comments</comments>
		<pubDate>Thu, 07 Feb 2013 10:19:55 +0000</pubDate>
		<dc:creator>Shaun</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[UIWindow]]></category>
		<category><![CDATA[voiceover]]></category>
		<category><![CDATA[windowLevel]]></category>

		<guid isPermaLink="false">http://shaune.com.au/?p=452</guid>
		<description><![CDATA[I have been playing around with using multiple UIWindows in an iOS application at my current client for the last few days and thought I would share what I perceive to be the pro&#8217;s and con&#8217;s. I will cover the technical challenges / observations I have witnessed when using UIWindows that sit above UIAlertViews when accessibility [...]]]></description>
			<content:encoded><![CDATA[<p>I have been playing around with using multiple UIWindows in an iOS application at my current client for the last few days and thought I would share what I perceive to be the pro&#8217;s and con&#8217;s. I will cover the technical challenges / observations I have witnessed when using UIWindows that sit above UIAlertViews when <strong>accessibility</strong> / <strong>VoiceOver</strong> mode is on in another post otherwise it will get lost.</p>
<h4>Why would I want to use multiple UIWindows?</h4>
<p>Well I guess a couple of the reasons would be that maybe you want to display a view that shows above system UIAlertViews, can cover the default keyboard or even make your app look like it is modifying the statusbar like Reeder.</p>
<p><span id="more-452"></span></p>
<p>Another great reason could be that you want to cover everything on your iOS application before it is placed into the background so that no screenshot can be taken of sensitive data, if you have any of course.</p>
<h4>Getting started with using multiple UIWindows</h4>
<p>UIWindows are simply special UIViews that can have their display order controlled via the <strong>windowLevel</strong> property.  You dont need to add a UIWindow as a subview of any other view.  By simply creating a new UIWindow and calling either <strong>[window setHidden:NO]</strong> or <strong>[window makeKeyAndVisible]</strong> depending on the level you gave it it will most likely appear on your screen.</p>
<p>All iOS apps start off with a UIWindow that you normally know as the<strong> [UIApplication sharedApplication].keyWindow</strong> or<strong> [UIApplication sharedApplication].delegate.window</strong>, this is the window where you normally set a <strong>window.rootViewController</strong> and from that point on you normally just deal with UIViewControllers.</p>
<p>There are 3 default window enum levels defined which are:</p>
<p><strong><span style="font-size: 14px;">UIWindowLevelNormal</span></strong><br />
<strong><span style="font-size: 14px;">UIWindowLevelStatusBar</span></strong><br />
<strong><span style="font-size: 14px;">UIWindowLevelAlert</span></strong></p>
<p>If you wanted to create a window that displayed above the statusbar but underneath UIAlertViews you could create a window with a windowLevel of UIWindowLevelStatusBar. If you wanted to create a window that sat above everything in your app you could simply set it to something like <strong>window.windowLevel = UIWindowLevelAlert + 1</strong> would be fine.</p>
<h4>Benefits I have found with using multiple UIWindows</h4>
<ol>
<li><span style="line-height: 21px;">It is super simple to display a view above everything else on your screen.</span></li>
<li><span style="line-height: 21px;">You can create your own custom UIAlertViews or Progress Overlays that can sit above everything else. </span></li>
<li><span style="line-height: 21px;">Allows you to hide sensitive data quickly when your app is moving to the background.  Before you app moves to the background simply put up a UIWindow that covers the whole screen, this will stop iOS from taking a screenshot and saving it on your device &#8230; of course this is only a concern for the extremely paranoid.</span></li>
</ol>
<h4>Some issues / gotchas you might run into when using your own UIWindows</h4>
<ol>
<li><span style="font-size: 14px; line-height: 21px;">You have to handle any rotation events manually.  Your custom UIWindows will not get any rotation notifications you must subscribe to these yourself and layout your window for the given orientation manually.</span></li>
<li><span style="font-size: 14px; line-height: 21px;">If another window in your application has a higher window level than your and your not in a position to change it well there is nothing you can do, your window will simply not appear above it.</span></li>
<li><strong style="font-size: 14px; line-height: 21px;">UIAlertViews</strong><span style="font-size: 14px; line-height: 21px;"> and </span><strong style="font-size: 14px; line-height: 21px;">UIActionSheets</strong><span style="font-size: 14px; line-height: 21px;"> are displayed on the level of </span><strong style="font-size: 14px; line-height: 21px;">UIWindowLevelAlert</strong><span style="font-size: 14px; line-height: 21px;">, if you need to cover them up keep this in mind.</span></li>
<li><strong style="font-size: 14px; line-height: 21px;">UIPopovers</strong><span style="font-size: 14px; line-height: 21px;"> seem to appear on the </span><strong style="font-size: 14px; line-height: 21px;">UIWindowLevelStatusBar</strong><span style="font-size: 14px; line-height: 21px;">, alerts still appear over </span><strong style="font-size: 14px; line-height: 21px;">UIPopovers</strong><span style="font-size: 14px; line-height: 21px;"> so this makes sense.</span></li>
<li><strong style="font-size: 14px; line-height: 21px;"><span style="font-size: 14px;">UIAlertViews</span></strong><span style="font-size: 14px;"> have their own special window which can be a pain in the arse which I will go into more detail in a follow up post.</span></li>
<li><span style="font-size: 14px;">When you make a <strong>UIWindow</strong> the <strong>keyWindow</strong> it means it will become the first responder for the ios keyboard etc.</span></li>
</ol>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://shaune.com.au/using-multiple-uiwindows-in-ios-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pretty GIT logs</title>
		<link>http://shaune.com.au/pretty-git-logs/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=pretty-git-logs</link>
		<comments>http://shaune.com.au/pretty-git-logs/#comments</comments>
		<pubDate>Tue, 19 Jun 2012 07:55:20 +0000</pubDate>
		<dc:creator>Shaun</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://shaune.com.au/?p=440</guid>
		<description><![CDATA[A really nice way to pretty up git logs!]]></description>
			<content:encoded><![CDATA[<p>A really nice way to <a href="http://coderwall.com/p/euwpig?i=3&amp;p=1&amp;t=git">pretty up git logs</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://shaune.com.au/pretty-git-logs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iOS Keychain: Sharing data between apps</title>
		<link>http://shaune.com.au/ios-keychain-sharing-data-between-apps/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ios-keychain-sharing-data-between-apps</link>
		<comments>http://shaune.com.au/ios-keychain-sharing-data-between-apps/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 08:07:54 +0000</pubDate>
		<dc:creator>Shaun</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://shaune.com.au/?p=402</guid>
		<description><![CDATA[Over the last week I have been playing around with the Keychain that comes with iOS to share data between multiple apps. I stumbled upon UICKeyChainStore which makes using the Keychain super simple. There are plenty of posts out there that cover simply using the Keychain but not that many cover sharing data between apps.  So [...]]]></description>
			<content:encoded><![CDATA[<p>Over the last week I have been playing around with the Keychain that comes with iOS to share data between multiple apps. I stumbled upon <a href="https://github.com/kishikawakatsumi/UICKeyChainStore">UICKeyChainStore</a> which makes using the Keychain super simple.</p>
<p>There are plenty of posts out there that cover simply using the Keychain but not that many cover sharing data between apps.  So that is exactly what this post will be about.  Sharing data between your iOS apps via the Keychain.<span id="more-402"></span></p>
<h4>Creating your first app that will write to the Keychain</h4>
<h5><span style="text-decoration: underline;">Setting up your project</span></h5>
<ol>
<li><span style="line-height: 21px;">Add the <strong>Security.framework</strong> to your project</span></li>
<li><span style="line-height: 21px;">Download <strong><a href="https://github.com/kishikawakatsumi/UICKeyChainStore">UICKeyChainStore</a></strong> and add the files to your project</span></li>
<li><span style="line-height: 21px;">Create a new <strong>Entitlements.plist </strong>file and specify a keychain group you want to write to in this case we will just specify our apps bundle identifier.</span></li>
<ul>
<li><a style="line-height: 21px;" href="http://shaune.com.au/wp-content/uploads/2012/04/initial-keychain.png"><img class="alignnone  wp-image-412" title="initial-keychain" src="http://shaune.com.au/wp-content/uploads/2012/04/initial-keychain-300x49.png" alt="" width="300" height="49" /></a></li>
<li><strong>$(AppIdentifierPrefix)$(CFBundleIdentifier)</strong> this will be resolved to your app Identifier prefix (aka bundle seed identifier) and your bundle identifier which is from your Info.plist.</li>
<li>For this example assume the value is <strong>$(AppIdentifierPrefix).com.my.firstapp</strong></li>
</ul>
<li>Browse to your current app Targets Summary tab. Scroll down the bottom and you will see a section called <strong>Entitlements</strong> specify your <strong>Entitlements.plist</strong> file and make sure <strong>Enable Entitlements</strong> is checked.</li>
</ol>
<h5><span style="text-decoration: underline;">Saving data and reading data from the Keychain</span></h5>
<p>Now all you need to do is start using the UICKeyChainStore and you&#8217;ll be saving data to the Keychain.</p>
<p><strong>[UICKeyChainStore setString:@"supersecret" forKey:@"password" service:@"MyService"];</strong></p>
<p><strong>[UICKeyChainStore stringForKey:@"password" service:@"MyService"];</strong></p>
<p>Specifying the service allows you to store keys for a particular service, maybe you have a Twitter or Facebook specific set of keys you wish to save.</p>
<p>As you can see we are not specifying the <strong>accessGroup.</strong> By default it will pick the first access-group specified in your <strong>Entitlements.plist </strong>when writing and will search across all access-groups when none is specified.</p>
<h4>Allowing your second app to access your shared keychain data</h4>
<p>So we have our first app which is saving data to the keychain group (<strong>$(AppIdentifierPrefix).com.my.firstapp</strong>) Now lets just say we decide to release a second app but we dont want users to have to re enter the same data, maybe we are persisting a login token or something so we want to try and read it if the user has our first app installed.</p>
<p>All you have to do to in order to be able to read from a shared keychain group is make sure both your apps use the same <strong>AppIdentifierPrefix </strong>and specify the keychain group of the keychain you want access to.</p>
<p>All apps that share the same <strong>AppIdentifierPrefix</strong> <strong>/ Bundle Seed Id</strong> can access each others Keychains if permission has been granted in your <strong>Entitlements.plist</strong> file.</p>
<h5><span style="text-decoration: underline;">Setting up your project</span></h5>
<ol>
<li>Add the <strong>Security.framework</strong> to your project</li>
<li>Download <strong><a href="https://github.com/kishikawakatsumi/UICKeyChainStore">UICKeyChainStore</a></strong> and add the files to your project</li>
<li>Create a new <strong>Entitlements.plist </strong>file and specify the keychain group of the first app you want to be able to read data from.</li>
<ul>
<li><a href="http://shaune.com.au/wp-content/uploads/2012/04/keychain-2.png"><img class="alignnone size-medium wp-image-430" title="keychain-2" src="http://shaune.com.au/wp-content/uploads/2012/04/keychain-2-300x48.png" alt="" width="300" height="48" /></a></li>
<li>We want access to the Keychain group <strong>$(AppIdentifierPrefix).com.my.firstapp</strong> for reading but we still want the default writing to occur in our own keychain group so we still specify<strong> $(AppIdentifierPrefix)$(CFBundleIdentifier) </strong>as the first / default group.</li>
</ul>
<li>Browse to your current app Targets Summary tab. Scroll down the bottom and you will see a section called <strong>Entitlements</strong> specify your <strong>Entitlements.plist</strong> file and make sure <strong>Enable Entitlements</strong> is checked.</li>
</ol>
<h5>Reading data from the shared Keychain</h5>
<p>Try and read the value from the shared Keychain exactly how we did in our first app.</p>
<p><strong>[UICKeyChainStore stringForKey:@"password" service:@"MyService"];</strong></p>
<p>This should return the value <strong>supersecret</strong>.</p>
<p>Congratulations you just successfully shared some data between two different iOS apps via the Keychain!</p>
<p>For more details checkout:</p>
<p><a href="http://developer.apple.com/library/ios/#samplecode/GenericKeychain/Introduction/Intro.html">Generic Keychain Example</a></p>
<p><a href="http://developer.apple.com/library/ios/#DOCUMENTATION/Security/Conceptual/keychainServConcepts/01introduction/introduction.html#//apple_ref/doc/uid/TP30000897">Keychain Services Programming Guide</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://shaune.com.au/ios-keychain-sharing-data-between-apps/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automated UI testing for iOS apps: UIAutomation + jasmine + jenkins</title>
		<link>http://shaune.com.au/automated-ui-testing-for-ios-apps-uiautomation-jasmine-jenkins/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=automated-ui-testing-for-ios-apps-uiautomation-jasmine-jenkins</link>
		<comments>http://shaune.com.au/automated-ui-testing-for-ios-apps-uiautomation-jasmine-jenkins/#comments</comments>
		<pubDate>Sun, 26 Feb 2012 09:57:23 +0000</pubDate>
		<dc:creator>Shaun</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://shaune.com.au/?p=359</guid>
		<description><![CDATA[A couple of months ago I was doing some iOS work at Sensis with regards to the Yellow Pages iPad app + SAPI integration. Rochana Attale and I needed to come up with a way to make it easy to hook up UI Automation acceptance tests written in Jasmine to our Jenkins CI environment.  Please [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" src="http://images.pictureshunt.com/pics/t/the_jetsons-5331.jpg" alt="" width="133" height="218" /></p>
<p>A couple of months ago I was doing some iOS work at Sensis with regards to the <a href="http://itunes.apple.com/au/app/yellow-pages-australia-for/id424516241?mt=8">Yellow Pages iPad app</a> + <a href="http://developers.sensis.com.au/">SAPI</a> integration. Rochana Attale and I needed to come up with a way to make it easy to hook up <a href="http://developer.apple.com/library/ios/#documentation/DeveloperTools/Reference/UIAutomationRef/_index.html">UI Automation</a> acceptance tests written in <a href="http://pivotal.github.com/jasmine/">Jasmine</a> to our Jenkins CI environment.  Please keep in mind at the time the <a href="http://www.zucchiniframework.org/" target="_blank">zucchini testing framework</a> wasn&#8217;t released which is why we put together our own solution.</p>
<p>And to be fair what we put together has worked out quite well.  It is a bit rough around the edges but at the same time extremely quick to get acceptance tests up and running.</p>
<p><span id="more-359"></span>Acceptance tests are critical for any application which is intended to be around for a while, and they are even more important if your intending to make some major changes (such as swapping out a backend API &#8230; which is what we did on Yellow iPad). So before we started making any massive changes to our app we wanted to find a way to automate the UI testing of our iOS application and ideally hook it up to jenkins.</p>
<p>Hopefully you find this post useful, as we were surprised as to how quick writing the tests were once you had your environment up and running. At the end of the day its only UI Automation with some BDD love via Jasmine.</p>
<h4>Download the example projects</h4>
<p>I have created 2 projects, one for writing / running our acceptances tests and the other is the app which our tests will run against.</p>
<p>So go ahead and clone the following two projects from github into the same parent directory:</p>
<p><a href="https://github.com/shaune/jasmine-ios-acceptance-tests">jasmine-ios-acceptance-tests</a><br />
Make sure you remember to run <strong>git submodule update &#8211;init</strong> to grab the jasmine-reporters dependency.</p>
<p><a href="https://github.com/shaune/jasmine-ios-acceptance-tests-basic-app">jasmine-ios-acceptance-tests-basic-app</a><br />
Build and run the app to make sure it is running in the simulator correctly.</p>
<h4>Running the tests in Instruments</h4>
<p>Firstly we will run our acceptance tests in Instruments so you can see how easy it is.</p>
<ol>
<li><span style="line-height: 21px;">Make sure you have Xcode 4.2 installed as a minimum.</span></li>
<li><span style="line-height: 21px;">Start <strong>Instruments</strong></span></li>
<li><span style="line-height: 21px;">Select the <strong>Automation</strong> template and click <strong>Choose</strong></span></li>
<li><span style="line-height: 21px;">Select the <strong>Choose Target</strong> <strong>drop down</strong> -&gt; <strong>Choose Target</strong> -&gt; <strong>Choose Target&#8230;</strong></span></li>
<li><span style="line-height: 21px;">A prompt will appear. Browse to the location of the <strong>BasicApp.app</strong> file and click <strong>Choose</strong>. For example mine is located at: /Users/shaune/dev/blog/jasmine-ios-acceptance-tests-basic-app/build/Debug-iphonesimulator/BasicApp.app </span></li>
<li><span style="line-height: 21px;">Now back to the Instruments window on your left hand panel you should have a section called <strong>Scripts</strong> under it is a drop down button called <strong>Add</strong>. <span style="color: #333333;"><strong>Click </strong><strong>Add</strong> -&gt; <strong>Import&#8230;</strong></span></span></li>
<li><span style="line-height: 21px;">Browse to the location of our <strong>ci.js</strong> file and click <strong>Open</strong>. For example mine is located at: /Users/shaune/dev/blog/jasmine-ios-acceptance-tests/ci.js</span></li>
<li><span style="line-height: 21px;">Now that we are all setup you should be able to click the<strong> little red button</strong> to launch the simulator and see our tests running.</span></li>
</ol>
<div><a href="http://shaune.com.au/wp-content/uploads/2012/02/instruments.png"><img class="aligncenter size-medium wp-image-373" title="Instruments Output" src="http://shaune.com.au/wp-content/uploads/2012/02/instruments-300x164.png" alt="" width="300" height="164" /></a></div>
<h4>Running the tests from the command line</h4>
<p>Also checked in is a basic shell script that you can use to kick off the acceptance tests from the command line OR from a Jenkins job.</p>
<p style="padding-left: 30px;">$ ./runTests.sh ci.js &#8220;/Users/shaune/dev/blog/jasmine-ios-acceptance-tests-basic-app/build/Debug-iphonesimulator/BasicApp.app&#8221;</p>
<p>Hopefully the output you see is: Build Passed</p>
<h4>Viewing test results in Jenkins</h4>
<p>To add this to Jenkins simply setup a new unix shell job and execute the runtTests shell script with your own test script + app.</p>
<p>If you now look in your<strong> jasmine-ios-acceptance-tests </strong>directory a new directory called <strong>test-reports</strong> has hopefully been created with a <strong>test-results.xml</strong> file.</p>
<p>All you need to do is now add this into Jenkins for your acceptance test job to look for JUnit reports and you will then be able to see your Jasmine + UI Automation acceptance tests reports in Jenkins!</p>
<h4>Super simple&#8230; but gets the job done</h4>
<p>Keep in mind that our solution is quite simple, but it was super quick to integrate with Jenkins and it works. Also I found that writing the Jasmine specs were really quick and using the script recorder in Instruments does half the job for you.</p>
<h4>What would I like to change?</h4>
<p>I would like to update the <strong>jasmine.uiautomation_junit_reporter.js</strong> so that it actually writes the <strong>test-reports/test-results.xml</strong> file instead of simply logging it and having the<strong> runTests.sh</strong>file grep for the output. This could be done via the <strong><a href="https://developer.apple.com/library/ios/#DOCUMENTATION/UIAutomation/Reference/UIAHostClassReference/UIAHost/UIAHost.html">UIAHost.performTaskWithPathArgumentsTimeout</a> </strong>call that can execute system commands.</p>
<h4>Still hungry for other test frameworks?</h4>
<p>If you are serious about setting up acceptance tests for your iOS application you should really consider checking out <a href="http://www.zucchiniframework.org/">zucchini</a> as well. It came out after we had already setup our acceptance test environment and is quite polished. It gives you the ability to write Gherkin&#8217;ish feature files and image comparison for verifying successful scenarios. If you have a UX team on board this will be ideal because you can test down to the pixel!</p>
]]></content:encoded>
			<wfw:commentRss>http://shaune.com.au/automated-ui-testing-for-ios-apps-uiautomation-jasmine-jenkins/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
