加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

iphone – UIAutomation:无法授权状态为-60007的权利

发布时间:2020-12-14 18:05:53 所属栏目:百科 来源:网络整理
导读:所以我在命令行上运行UIAutomation $instruments -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate path-to-your-app/appname.app/ -e UIASCRIP
所以我在命令行上运行UIAutomation

$instruments -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate 
<path-to-your-app>/<appname>.app/ -e UIASCRIPT <path-to-your-js-test-file> -e 
UIARESULTSPATH <path-to-results-folder>

这工作正常,模拟器打开,应用程序运行,但卡住此错误.

Failed to authorize rights (0x2) with status: -60007

我认为这与权限有关.

我该怎么做?

解决方法

这就是我在 Instruments via command line – jenkins发布的答案

这里甚至还有关于Xcode command line authorization prompt error的博客文章

我会在这里再解释一下:

我做的是以下内容:

>将jenkins用户标记为管理员(遗憾的是,似乎没有其他方式atm)
>转到/ etc / authorization
>搜索关键system.privilige.taskport
>将allow-root的值更改为true

<key>system.privilege.taskport</key>
<dict>
    <key>allow-root</key>
    <false/> // change to -> <true>
    <key>class</key>
    <string>user</string>
    <key>comment</key>
    <string>Used by task_for_pid(...).
    ...
</dict>

现在我可以使用jenkins通过命令行脚本运行我的UIAutomation-Tests

编辑

为了让jenkins认识到一个成功的构建,我没有一个完美的解决方案,但以下解决方法:

...
echo "Run instruments simulator"

instruments -t "$ORDER_AUTOMATION_TEST_TEMPLATE_PATH" "$FILE_DEBUG_APP" -e UIASCRIPT "$ORDER_AUTOMATION_TESTSCRIPT_PATH" -e UIARESULTSPATH "$DIRECTORY_INSTRUMENTS_RESULT"

returnCode=0

if test -a "Run 1/Assertion failed.png"; then
echo "failed"
returnCode=1
else
echo "passed"
returnCode=0
fi

rm -fR "Run 1"

rm -fR "instrumentscli0.trace"

echo "Removing app dir"

echo "$FILE_APPLICATIONS"

rm -fR "$FILE_APPLICATIONS"

echo $returnCode

exit $returnCode

编辑2
检查自动化测试是否成功运行的更好方法:

# cleanup the tracefiles produced from instruments
rm -rf *.trace

##kill simulator afterwards
killall "iPhone Simulator"

##check if failures occured
# fail script if any failures have been generated
if [ `grep "<string>Error</string>" "$WORKSPACE/Automation Results/Run 1/Automation Results.plist" | wc -l` -gt 0 ]; then
    echo 'Build Failed'
    exit -1
else
    echo 'Build Passed'
    exit 0
fi

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读