2

I have automated my iOS application using UIAutomation, To run this I launch iOS Instruments and run the script. If Same automation script I want to run to the device I use the below command which works as desired

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

But how do I run this from the command line to iOS Simulator ?

Please suggest.

Thanks Sougata

User97693321
  • 3,336
  • 7
  • 45
  • 69
  • Where do you keep this regression.js and any good tutorial for learning to write script's for automation – nikhil84 Jul 02 '14 at 08:40

2 Answers2

2

If you don't supply the '-w' argument and build your app for the simulator sdk it should launch on the simulator.

Brian Yarger
  • 1,965
  • 18
  • 17
  • That time I get the below error, instruments[25317:60f] Argument 'UIASCRIPT' does not point to a valid script. Using script defined in template. Thu Nov 10 10:01:25 shopablejob-lx instruments[25317] : kCGErrorInvalidConnection: CGSGetCurrentCursorLocation: Invalid connection – Sougata Bhattacharya Nov 10 '11 at 04:35
  • one thing if I use a simple js, it launch the iPad simulator but throws below exception Thu Nov 10 14:48:17 shopablejob-lx instruments[26766] : kCGErrorInvalidConnection: CGSGetCurrentCursorLocation: Invalid connection Thu Nov 10 14:48:17 shopablejob-lx instruments[26766] : kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged. 2011-11-10 14:48:17.976 instruments[26766:60f] Recording cancelled : At least one target failed to launch; aborting run Instruments Trace Error : Failed to start trace. – Sougata Bhattacharya Nov 10 '11 at 09:21
  • Does this script work if you run it via the Instruments app (not command line)? I think you need to use "myapp.app" which should be a path to your built application. I have a script which builds my app to a specific folder and then I use the path the the .app folder. – Brian Yarger Nov 10 '11 at 16:12
0

In Xcode 6.0.1, running with the -w switch and passing in the symbolic name of the simulator appears to now be required (at least that's the only way I got it to work, and I've had others verify and point me to this solution).

See my answer from another post that has an explicit example.

You can also find a bash shell script that will handle invocation for you, automating the resolution of UDID and GUIDs in your simulator app paths.

Community
  • 1
  • 1
idStar
  • 10,674
  • 9
  • 54
  • 57