问题
I am able to run instrument using command line for a single device / simulator, but I need to run it on two devices. Manually I can achieve this by opening two new window of Instruments and make two copy of the js and import it. But I need to achieve this using Command Line. Can anybody help me in achieving this or does anybody have the guidelines for the same?
回答1:
I struggled with this as well here is a part of my solution. What i did is:
Create trace files in instruments with you script .js file pre selected and save it to disk.
Reads the UDID of all connected devices. Loop trough all connected devices and replace the UDID in your trace file with the currenct UDID. In the same loop open instruments.
for line in $(system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' -e '/iPhone/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2}'); do
UDID=${line}
file$x $(replace 345w67ww89ww0w98w762wewq33e2 with ${UDID})
open -a Instruments /PATH/TO/TRACE/file$x
done
This solution will open multiple windows of Instruments. You can go trough them with appleScript to click the record button.
回答2:
Another way to achieve it is to open two separate instance of Instrument and execute it
来源:https://stackoverflow.com/questions/12195736/instrument-multiple-device-execution