菜鸟教程小白 发表于 2022-12-13 07:59:37

ios - 如何将仪器附加到模拟器以进行 UI 自动化测试


                                            <p><p>我正在尝试弄清楚如何进行自动化 UI 测试,以便在进行更改等时测试我的应用程序是否存在回归错误。我按照 <a href="https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/UsingtheAutomationInstrument/UsingtheAutomationInstrument.html" rel="noreferrer noopener nofollow">Apple&#39;s documentation</a> 中的说明进行操作.我在 Xcode 中构建了我的应用程序,它在 iOS 模拟器中运行。 </p>

<p>我打开 Instruments 并选择了 iOS 自动化工具。但是,我似乎无法弄清楚如何让 Instruments 在 sim 中的 iOS 应用程序上运行脚本。当我第一次创建自动化仪器时,目标下拉菜单只显示“lkj”,但如果我尝试选择 sim 作为目标,它会告诉我自动化仪器不允许附加。</p>

<p> <img src="/image/tBMJV.png" alt="enter image description here"/> </p>

<p>如何让 Instruments 在我的 iOS 应用上运行我的测试? </p>

<p>我尝试在选择“lkj”目标的情况下运行它,但我遇到了一个奇怪的错误,涉及某个随机人的名字(我假设他是 Instruments 的开发人员或其他什么?)</p>

<blockquote>
<p>Path not found
&#39;/Users/jonathan_morgan/Library/Developer/Xcode/DerivedData/lkj-randomstringofcharacters/Build/Products/Release-iphonesimulator/lkj.app/lkj</p>
</blockquote></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>将目标附加到模拟器并运行 UIAutomation 脚本的最简单方法是分析应用程序。 <strong>Xcode</strong> - <strong>Product</strong> - <strong>Build For</strong> - <strong>Profiling</strong>,然后选择 <strong>Automation</strong> 模板。 </p>

<p>另一种附加目标的方法,如果您已经在模拟器上构建了应用程序。是选择<strong>Choose Target</strong>,然后转到以下位置<strong>/Users//Library/Application Support/iPhone Simulator//Applications// </strong></p>

<p>有关更多信息,您可以查看此博客,该博客非常详细 <a href="http://blog.manbolo.com/2012/04/08/ios-automated-tests-with-uiautomation" rel="noreferrer noopener nofollow">http://blog.manbolo.com/2012/04/08/ios-automated-tests-with-uiautomation</a> </p>

<p>希望对你有帮助。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 如何将仪器附加到模拟器以进行 UI 自动化测试,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/24004026/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/24004026/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 如何将仪器附加到模拟器以进行 UI 自动化测试