So I’m trying to automate the cirtical path of an iOS application. I’ve already got the basics down with getting the application loaded, and started. Even have the tests logging in. Sort of.

Like many applications, on start it can be in many states on start. Such as authenticated, anonymous, or just plain loading. Right now I’m getting a missing selector, we’ll call it the hamburgler…My current theory is the driver is searching for this element on start but before the screen has actually finished loading. First step is to add a one second delay maybe? Hmm…helps if I don’t uninstall the application.

In short the script is setup to boot a new simulator or use the one instructed on the command line. While developing I’ve found it’s a lot quicker to boot the simulator and run from Xcode. Keep an instance of Appium running and I’ve got a super fast edit-test cycle going there. There is one more slow part, when Appium initial gets up and running. For whatever reason it displays the annoying network connection firewall exception dialog. The one that warns bad things could happen becuase it’s not signed by someone who has an Apple certificate. Funny part is Appium builds this application every time your against the simulator…so it should trust my own binaries. At least in my opinion.

So I borked Appium. Like entirely. kill -9 style. It intercepts SIGINT, which makes sense since is drives other procs. But kind of silly there isn’t a better way to hand it. Maybe SIGSTOP. Well, I done messed up; wrong AppId, which you need to use. Now everything that works! Yay!

Overall I think Ruby is an awesome language for this kind of work. Types often change and you don’t need to care exactly what you are talking about. UI Automation is a fuzzy art in my opinion. A lot of cases the question comes up “does this view quak in the way I expect?”. Benefit of buidling out UI automation is sometimes you find interesting ways to break the application because of timing problems or the testing script crashing in places you would have never exiteded the application from.

A problem I’ve repeatedly encountered is how to push information between view controllers while using correct optionality. As in we have a number of UIViewControllers which require specific objects or data structure to perform their responsibility…but I haven’t found a good method for communicating such information. For now I’m using something along the lines of var criticalData : SomeType! and in the viewWillAppear(Bool) I’ll do guard criticalData != nil else { logError(); abort; }. That is really horrible but I don’t have a better method to enforce data requirements yet.

So upon furhter thinking about it, I actually started using the pattern:

extension ProjectVC {
	func responsibilityOfViewController( arrows : Quiver ){
		let vc = storyboard.instantiateViewControler( "Target" ) as! TargetVC
		vc.quiever = arrows
		navigationController.pushViewControllre( vc, animate: true )

Or something like that. You get the gist.