Instruments-Automation: 通过命令行执行测试用例

    为了实现该脚本的自己主动定时执行。我们需要开始在命令行和脚本,详细代码如下所示的:

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>


1.  -t 后面的參数为 Automation.tracetemplate 的路径。每一个版本号的位置都有所不同,在命令行下使用 instruments -s 命令进行查询。


2.  full_path_to_application 是你的的被測应用的完整文件夹,须要在前后加上双引號。
3.  -e UIASCRIPT  指定运行的 js 脚本存放的位置,须要在前后加上双引號。
4.  -e UIARESULTPATH  指定输出结果存放的路径,须要在前后加上双引號。

5. 假设须要在真机执行。在-t 參数前加上  -w UDID, 当中UDID为被连接手机的设备标识(可通过iTools查看)。


举例在我本地模拟器上的脚本例如以下:

instruments -t 
/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate 
"/Users/wangxinxin/Library/Developer/Xcode/DerivedData/TestAutomation-ahmqgmqipyidexemazbprqxqkrya/Build/Products/Debug-iphonesimulator/TestAutomation.app" 
-e UIASCRIPT "/Users/wangxinxin/Documents/TestAutomation/test.js" 
-e UIARESULTSPATH "/Users/wangxinxin/Documents/TestAutomation"


版权声明:本文博客原创文章,博客,未经同意,不得转载。

原文地址:https://www.cnblogs.com/zfyouxi/p/4749768.html