Wednesday August 21, 2013

UIAuto - Simpler CLI Interaction with UI Automation

Mike Enriquez read my book and decided to write up a RubyGem that makes it easier to use UI Automation from the command line. It’s a slick wrapper that uses sensible defaults to find your app bundle and know where to put trace results. But the best part is the way he lets you snapshot and reuse the state of the application as it exists in the simulator for your tests.

By running this command:

uiauto simulator save uiauto/simulator_data/with_tasks

…you end up saving a snapshot that you can call up to reset the simulator in the same state that you left it, giving you a consistent state to re-run your tests. Or you can trigger different snapshots with a magic comment at the top of your individual test files, similar to the way I use magic comments to set environment variables in the sample code with my book.