Chris Riesgo: Xamarin Test Recorder for iPhone

Xamarin Test Recorder for iPhone

Xamarin Test Recorder is a really neat way to automate your mobile UI tests.

The tool lets you connect your mobile application to a device or simulator and record interactions with your app. The recorded interactions can then be fine-tuned and output as C# test cases. Those test cases can be saved for reuse in your own UI test automation projects or uploaded directly to Xamarin Test Cloud.

There are some general articles on recording tests using the test recorder, but I didn’t see any with specific instructions for setting things up for iPhone on a mac. This is my attempt at closing that gap. Hope this helps you too!

Getting Started

Here’s a basic getting started and requirements article from Xamarin.

Required: Pay close attention to the device provisioning instructions. In order to test your app on an iOS device, your app must have a development provisioning profile configured for the specific device in your Apple Developer portal.

For this post, I’m going to target a very specific version of the Xamarin Test Recorder. Because this tool is still in Preview, I want to make sure that I’m explicit.

Version

To download the test recorder, visit the getting started link, then click the Weekly Build link along the right side panel.

Xamarin Test Recorder for iPhone

After downloading the installer and installing the app, you may be prompted to download the latest Weekly Build.

Important Note: Continue only if you’re being asked to install version 0.13.0 or greater. Device support for iPhone doesn’t appear to exist in earlier builds.

You can confirm the version you have installed by checking the About Test Recorder menu.

Xamarin Test Recorder for iPhone

This is the version I’m running for this post.

Xamarin Test Recorder  
Version 0.13.0 (1.0)  
Xamarin  

If your version doesn’t match what I have, you can check for updates.

Xamarin Test Recorder for iPhone

Xamarin Test Recorder for iPhone

Preferences

There are some preferences that can be set.

Account: Insert your Xamarin Test Cloud API Key

General: See image below
Xamarin Test Recorder for iPhone

Advanced: Android SDK and Mono Locations

Record an iPhone Test

See the Xamarin developer documentation on Recording a Test for detailed steps with screenshots.


Having Trouble?

I’m going to embed a little in case you see this too (ICYSTT) section to this post. I was plagued with problems when I tried to get started; almost to the point that I assumed there was a bug that I wouldn’t be able to work around.

Steps
  1. I chose my attached iPhone device
  2. I selected my Debug|iPhone compiled .ipa
  3. Then, after a few seconds of the test recorder attempting to connect, I would see this popup error:

    failed to install app /var/folders/7k/msfhh81j6hv3xdr09h1122hh004444/t/tmp574fcd7.tmp/payload/iostest.app: applicationname='/var/folders/7k/msfhh81j6hv3xdr09h1122hh0000gn/t/xdb/deviceagent.ios.dependencies/93c12f7393c12d1493c1d41793c14444/bin/iosdevicemanager', commandline='install -d 3d0e3d0e3d0e3d0e3d0e3d0e3d0e3d0e3d0e3d0e -a /var/folders/7k/msfhh81j6hv3xdr09h1122hh004444/t/tmp574fcd7.tmp/payload/iostest.app', currentdirectory='', native error= cannot find the specified file

This forum post helped me.

A colleague had a similar problem when attemping to run UITests against an iOS simulator. The “fix” mentioned in the forum helped her, and ended up helping me too. Basically, delete the {tempdir}/xdb/ directory ( /var/folders/7k/msfhh81j6hv3xdr09h1122hh0000gn/t/xdb/) then try again.

Xamarin also has a link for some Known Issues.


Hope this helps you guys! Leave comments below. I’d like to hear about the things you’re testing.