Can a user interface automation tool be launched from the command line?

Is there a way to open the UIAutomation tool through the terminal?

Can I write AppleScript to open the Apple UIAutomation tool and download the testing application?

Could you tell me if there is any way through scripting or through the command line, we can open UIAutomation and select an application for testing, as well as select a test script?

+53
iphone xcode applescript instruments ios-ui-automation
Nov 16 '10 at 7:17
source share
9 answers
 instruments -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/\ PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate \ <full_path_to_application> -e UIASCRIPT <path_to_script.js> \ -e UIARESULTSPATH <output_results_path> 

for xcode> = 4.5

 instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/\ AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate \ <full_path_to_application> -e UIASCRIPT <path_to_script.js> \ -e UIARESULTSPATH <output_results_path> 

for xcode> = 6.1

 instruments -w <device ID> -t \ /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/\ AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate \ <full_path_to_application> -e UIASCRIPT <path_to_script.js> \ -e UIARESULTSPATH <output_results_path> 

There are several important points:

  • the -w option is not required if you do not want to run scripts on your device. If you want to run scripts on the simulator, simply omit this parameter from the command.
  • full_path_to_application is the path to your .app file that your simulator creates. For me, the path was

    / Users / fwasim / Library / Application Support / iPhone Simulator / 5.0 / Applications / AA6BA2E1-D505-4864-BECC-29ADEE28194D / name_of_application.app

    this path may be different for everyone else, depending on which version of iOS is running on your simulator. Also remember to put this path in double quotes.

  • The path_to_script.js path should be FULL PATH, where your automation script written in javascript is stored. Also remember to put this path in double quotes.

  • The final path to output results is the path that you want to save output results to. Also remember to put this path in double quotes.

These were those moments in which I was absent, and thus received some of the errors mentioned above.

+54
Jun 22 2018-12-22T00:
source share

Starting UIAutomation via the command line You can do it now, starting with Xcode 4.2 for iOS5 beta 4. From the command line, you can run the tools that point to the automation template and specify the test script that you want to execute and the destination path for the environment variables. Results:

tools -w -t / Developer / Platforms / iPhoneOS.platform / Developer / Library / Instruments / PlugIns / AutomationInstrument.bundle / Contents / Resources / Automation.tracetemplate -e UIASCRIPT

Above from this source url: http://dev-ios.blogspot.com/2011/07/starting-uiautomation-via-command-line.html

More on Apple's command line: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/instruments.1.html

Plus a message from the Stacktrace user on the command line using iphone iOS UIAutomation Can I use the tools on the command line?

Hope this helps - have a good time :)

+22
Aug 10 2018-11-11T00:
source share

Updated and tested for Xcode 6.0.1 :

 instruments -w 'iPhone 5s' \ -t '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate' \ '/Users/sohail/Library/Developer/CoreSimulator/Devices/7232A640-A9D2-4626-A2AD-37AFFF706718/data/Containers/Bundle/Application/E71B915E-051D-4BEF-9083-34416D02EC91/RoadRunnerRadar.app' \ -e UIASCRIPT '/Users/sohail/Developer/clients/acme/roadrunnerradar/ACMERoadRunnerRadarAutomationTests/TestRunner.js' \ -e UIARESULTSPATH '/Users/sohail/Developer/clients/acme/roadrunnerradar/ACMERoadRunnerRadarAutomationTests/TestResults/' 

Inspired by others who wrote command-line wrappers that didn't update at the time and therefore didn't work (and it seemed hard to understand how I was tempted to resurrect them), I wrote a bash shell script, which I believe will be more transparent, easier and therefore easier to maintain.

You can find the github project and blog

+8
Sep 20 '14 at 22:23
source share

Instead of the long instruments command, I wrote a more convenient shell: https://github.com/enriquez/uiauto

To use it, you just need to do the following:

  • Create your project in Xcode for the simulator (device support is coming soon).
  • cd where your .xcodeproj or .xcworkspace project is located.
  • Run uiauto exec path/to/your/script.js .
+6
Aug 17 '13 at 18:28
source share

With each new version of Xcode, the template path seems to change. One of the best ways to find the path to a template is with the instruments -s command, which lists all the available templates.

+4
Jan 10 '13 at 22:29
source share

I was also very interested in this topic. In fact, I found this reference , which shows that there is a way to start tools from the terminal with a predefined template, a place where the results should be stored, and the target device on which it should work, and other parameters. You can also simply enter the instruments terminal to get a list of parameters.

I was not able to launch UI Automation on the iPhone in this way. I have not tried a simulator or application for Mac, because I am most interested in the device. I posted the question here on SO , but due to the lack of an answer, I think that not many people use tools in this way.

But there is hope for its launch, as there isn’t its short topic on the Apple Developers Forum (you need to log in) who suggest that this can be done. I will try this later, if I succeed, I will post the solution here. If you manage to do this, vote here, as I (and possibly others) will be interested.

+3
Jan 21 '11 at 11:15
source share

there is a tool for recording / playing UI events with the shell environment and can write a script with ruby.

iPhone App Interactive Development http://github.com/wookay/libcat

+2
Mar 24 2018-11-11T00:
source share

Enter this command in the terminal tools -s, you will get the path to the template after the type:

 instruments -t <template path> <Application file path> -e UIASCRIPT <script.js> UIARESULTPATH <result_path> 
0
Mar 08 '13 at 16:06
source share

The correct way to do this on an iOS simulator is as follows:

 instruments -w 'iPhone 5s (9.1)' \ -t '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate' \ 'justTheNameOfYourAppDontAddExtension' \ -e UIASCRIPT '/Users/barry/Dropbox/Public/login.js' \ -e UIARESULTSPATH '/Users/barry/Dropbox/Public/ 
0
Dec 16 '15 at 8:35
source share



All Articles