菜鸟教程小白 发表于 2022-12-12 12:17:07

ios - 使用 Jenkins 对 iOS 进行单元测试


                                            <p><p>我正在尝试使用 jenkins 自动化我的 iOS 项目。
但是,我想用 jenkins 测试的项目遇到问题。</p>

<p>该项目名为 <code>ttt</code> 并使用 cocoapods,因此它也有一个名为 <code>ttt</code> 的工作区。</p>

<p>查看项目中存在的以下方案。
<a href="/image/R1eHx.png" rel="noreferrer noopener nofollow"><img src="/image/R1eHx.png" alt="enter image description here"/></a> </p>

<p>我关注了<a href="http://mmorejon.github.io/en/blog/continuous-integration-jenkins-ios9-xcode/" rel="noreferrer noopener nofollow">this</a>教程。</p>

<p>我所做的设置如下
<a href="/image/P9vY5.png" rel="noreferrer noopener nofollow"><img src="/image/P9vY5.png" alt="enter image description here"/></a> </p>

<p> <a href="/image/c9D1k.png" rel="noreferrer noopener nofollow"><img src="/image/c9D1k.png" alt="enter image description here"/></a> </p>

<p> <a href="/image/2J5O7.png" rel="noreferrer noopener nofollow"><img src="/image/2J5O7.png" alt="enter image description here"/></a> </p>

<p>当我尝试运行它时,它会卡在这里!</p>

<pre><code>Going to invoke xcodebuild:, scheme: ttt, sdk: DEFAULT, workspace: ttt, configuration: Debug, clean: NO, archive:NO, symRoot: DEFAULT, configurationBuildDir: DEFAULT, codeSignIdentity: DEFAULT
$ /usr/bin/xcodebuild -scheme ttt -workspace ttt.xcworkspace -configuration Debug build test -destination &#34;platform=iOS Simulator,name=iPhone 6,OS=10.1&#34;
</code></pre>

<p>当我从工作区字段中删除 <code>ttt</code> 时,我收到以下错误</p>

<pre><code>Going to invoke xcodebuild:, scheme: ttt, sdk: DEFAULT, project: DEFAULT, configuration: Debug, clean: NO, archive:NO, symRoot: DEFAULT, configurationBuildDir: DEFAULT, codeSignIdentity: DEFAULT
$ /usr/bin/xcodebuild -scheme ttt -configuration Debug build
xcodebuild: error: The project named &#34;ttt&#34; does not contain a scheme named &#34;ttt&#34;. The &#34;-list&#34; option can be used to find the names of the schemes in the project.
Build step &#39;Xcode&#39; marked build as failure
Recording test results
</code></pre></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>好吧,为什么它不起作用与该方案实际上并未发送到 git 的事实有关。
您需要在 xcode 项目中指定它,否则它甚至不会显示为您可以提交的文件。</p>
<p>为此,请转到 <code>xcode > Product > Scheme > Manage Schemes</code><br/>
您将看到一个屏幕,其中包含项目中的所有方案,请确保勾选 <code>Shared</code> 下的框,以获取您想在 Jenkins 中使用的所有方案。</p>
<p> <a href="/image/bFUSD.png" rel="noreferrer noopener nofollow"><img src="/image/bFUSD.png" alt="enter image description here"/></a> </p>
<p>将此推送到您的 git 并重试。它现在应该可以工作了。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 使用 Jenkins 对 iOS 进行单元测试,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/40536087/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/40536087/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 使用 Jenkins 对 iOS 进行单元测试