You can use the instruments in the Xcode tool to automatically open the application by executing the script. The following commands are executed:
<p style= "margin-top:0px; margin-bottom:10px; padding-top:0px; padding-bottom:0px; " ><span class= "PLN" style= "Color:rgb (0, 0, 0);" >instruments </span><span class= "pun" style= "Color:rgb" (102, 102, 0); " >-</span><span class= "PLN" style= "Color:rgb (0, 0, 0);" >w </span><span class= "str" style= "Color:rgb (0, 136, 0);" ><udid></span><span class= "PLN" style= "Color:rgb (0, 0, 0);" > </span><span class= "pun" style= "Color:rgb (102, 102, 0);" >-</span><span class= "PLN" style= "Color:rgb (0, 0, 0);" >t </span> <span class= "pun" style= "Color:rgb" (102, 102, 0); " >/</span><span class= "Typ" style= "Color:rgb (102, 0, 102);" >applications</span><span class= "pun" style= "Color:rgb (102, 102, 0);" >/</span><span class= "Typ" style= "Color:rgb (102, 0, 102);" >xcode</span><span class= "pun" style= "Color:rgb (102, 102, 0);" >.</span><span class= "PLN" style= "ColoR:rgb (0, 0, 0); >app</span><span class= "pun" style= "Color:rgb (102, 102, 0);" >/</span><span class= "Typ" style= "Color:rgb (102, 0, 102);" >contents</span><span class= "pun" style= "Color:rgb (102, 102, 0);" >/</span><span class= "Typ" style= "Color:rgb (102, 0, 102);" >applications</span><span class= "pun" style= "Color:rgb (102, 102, 0);" >/</span><span class= "Typ" style= "Color:rgb (102, 0, 102);" >instruments</span><span class= "pun" style= "Color:rgb (102, 102, 0);" >.</span><span class= "PLN" style= "Color:rgb (0, 0, 0);" >app</span><span class= "pun" style= "Color:rgb (102, 102, 0);" >/</span><span class= "Typ" style= "Color:rgb (102, 0, 102);" >contents</span><span class= "pun" style= "Color:rgb (102, 102, 0);" >/</span><span class= "Typ" style= "Color:rgb (102, 0, 102);" >plugins</span><span class= "pun" style= "Color:rgb (102, 102, 0);" >/</span>≪span class= "Typ" style= "Color:rgb (102, 0, 102);" >automationinstrument</span><span class= "pun" style= "Color:rgb (102, 102, 0);" >.</span><span class= "PLN" style= "Color:rgb (0, 0, 0);" >bundle</span><span class= "pun" style= "Color:rgb (102, 102, 0);" >/</span><span class= "Typ" style= "Color:rgb (102, 0, 102);" >contents</span><span class= "pun" style= "Color:rgb (102, 102, 0);" >/</span><span class= "Typ" style= "Color:rgb (102, 0, 102);" >resources</span><span class= "pun" style= "Color:rgb (102, 102, 0);" >/</span><span class= "Typ" style= "Color:rgb (102, 0, 102);" >automation</span><span class= "pun" style= "Color:rgb (102, 102, 0);" >.</span><span class= "PLN" style= "Color:rgb (0, 0, 0);" >tracetemplate </span><span class= "str" style= "Color:rgb (0, 136, 0);" ><full_path_to_application></span><span class= "PLN" style= "Color:rgb (0, 0, 0);" > </span> <span class= "pun" style= "Color:rgb (102, 102, 0);" >-</span><span class= "PLN" style= "Color:rgb (0, 0, 0);" >e uiascript </span><span class= "pun" style= "Color:rgb" (102, 102, 0); " ><</span><span class= "PLN" style= "Color:rgb (0, 0, 0);" >path_to_script</span><span class= "pun" style= "Color:rgb (102, 102, 0);" >.</span><span class= "PLN" style= "Color:rgb (0, 0, 0);" >js</span><span class= "pun" style= "Color:rgb (102, 102, 0);" >></span> <span class= "pun" style= "Color:rgb (102, 102, 0);" >-</span><span class= "PLN" style= "Color:rgb (0, 0, 0);" >e uiaresultspath </span><span class= "str" style= "Color:rgb" (0, 136, 0); " ><output_results_path></span></p>
Where Automation.tracetemplate is a uiautomation template file, it is generally fixed in a Mac device.
<full_path_to_application> application of AppID, need to add double quotes
<path_to_script.js> execute the Test JS script path, need to add double quotes
<output_results_path> test output path, need to add double quotes, can not fill
Write a simple test script to verify:
<p style= "margin-top:0px; margin-bottom:10px; padding-top:0px; padding-bottom:0px; " ><span class= "KWD" style= "Color:rgb (0, 0, 136);" >var</span><span class= "PLN" style= "Color:rgb (0, 0, 0);" > Target </span><span class= "pun" style= "Color:rgb (102, 102, 0);" >=</span><span class= "PLN" style= "Color:rgb (0, 0, 0);" > </span><span class= "Typ" style= "Color:rgb (102, 0, 102);" >uiatarget</span><span class= "pun" style= "Color:rgb (102, 102, 0);" >.</span><span class= "PLN" style= "Color:rgb (0, 0, 0);" >localtarget</span><span class= "pun" style= "Color:rgb (102, 102, 0);" > (); </span></p><p style= "margin-top:0px; margin-bottom:10px; padding-top:0px; padding-bottom:0px; " ><span class= "PLN" style= "Color:rgb (0, 0, 0);" >target</span><span class= "pun" style= "Color:rgb (102, 102, 0);" >.</span><span class= "PLN" style= "Color:rgb (0, 0, 0);" >delay</span><sPan class= "pun" style= "Color:rgb (102, 102, 0);" > (</span><span class= "lit" style= "Color:rgb" (0, 102, 102); " >15</span><span class= "pun" style= "Color:rgb (102, 102, 0);" >);</span> </p>
The result of executing the script is to open the application for 15 seconds before closing.