<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # 使用 UIAutomation 框架的 iOS 自動化測試 > 原文: [https://www.guru99.com/ios-test-program-uiautomation-framework.html](https://www.guru99.com/ios-test-program-uiautomation-framework.html) 為了保證您的 iOS 應用程序的質量,您應該遵循下圖所示的``測試驅動開發''過程。 ![Your First iOS test program using UIAutomation framework](https://img.kancloud.cn/08/eb/08ebbc6aaa25efa587a4ea61ee7061d8_521x461.png "Your First iOS test program using UIAutomation framework") 測試驅動開發(TDD)是一種[測試](/software-testing.html)模型,適用于 iOS 應用程序測試。 在此模型中,測試人員必須遵循以下四個階段: * **設計**:確定要測試的內容,設計測試用例 * **測試**:運行所有測試,看看測試用例是否失敗 * **實施**:修改您的代碼,修復導致測試失敗的錯誤 * **再次測試**:如果失敗,則返回設計。 如果所有測試用例都通過,則該代碼符合整個測試需求。 ## 設置測試環境 要創建 iOS 測試程序,您需要一本 **Mac Book。** 您的 Mac 已安裝: * OSX。Mac PC 的操作系統 * Xcode IDE,iOS 開發工具 * 自動化測試框架(UIAutomation,OCUnit ..) * iOS SDK 4(或更高版本) ## 使用 UIAutomation 框架創建 iOS 測試程序。 1. **發射工具** Open XCode-> Open Developer Tool-> **工具** ![Your First iOS test program using UIAutomation framework](https://img.kancloud.cn/9d/f1/9df15de9df7b2da31202259a19aad696_550x284.png "Your First iOS test program using UIAutomation framework") 2. **添加自動化儀器** 在**儀器**窗口中,選擇**自動化儀器** ![Your First iOS test program using UIAutomation framework](https://img.kancloud.cn/f3/d1/f3d1d2bf838b3725b18397e1b5995d1a_544x451.png "Your First iOS test program using UIAutomation framework") 要創建測試腳本,您可以**記錄**,[測試場景](/test-scenario.html),也可以手動**對其編程**。 3. 儀器正在啟動,**立即停止**錄制。 如果要開始記錄,請按紅色按鈕 ![Your First iOS test program using UIAutomation framework](https://img.kancloud.cn/ee/3f/ee3fcc49adf0169a906a076bc9128ebb_552x349.png "Your First iOS test program using UIAutomation framework") 4. 在腳本窗口中,單擊**添加>創建**以創建新腳本 ![Your First iOS test program using UIAutomation framework](https://img.kancloud.cn/c6/6c/c66cf55870782b94083626231becb67c_232x212.png "Your First iOS test program using UIAutomation framework") 5. **選擇目標** 您在“跟蹤”窗口中,使用“選擇目標”下拉菜單導航到應用程序的調試版本。 ![Your First iOS test program using UIAutomation framework](https://img.kancloud.cn/c9/e8/c9e869ac8d37c86a959aa0162e185567_596x429.png "Your First iOS test program using UIAutomation framework") 在這種情況下,我將使用 Apple 的示例 [SimpleDrillDown](http://developer.apple.com/library/ios/#samplecode/SimpleDrillDown/Introduction/Intro.html) 簡單應用程序作為被測試的應用程序。 它在下面具有 GUI。 ![Your First iOS test program using UIAutomation framework](https://img.kancloud.cn/ed/88/ed888806ca3bbde44a04b01bc3e3b97e_324x314.png "Your First iOS test program using UIAutomation framework") 6. **開始記錄您的腳本** 通過點擊工具頂部或底部的**記錄**按鈕來記錄腳本。 ![Your First iOS test program using UIAutomation framework](https://img.kancloud.cn/64/ce/64ce1ea5f18b5c1152a71e69dbaaf642_111x48.png "Your First iOS test program using UIAutomation framework") 現在,您可以在測試中的應用程序上執行一些 UI 操作,并記錄腳本。 7. **查看您的腳本** 要查看您的腳本,請點擊**跟蹤日志/編輯器日志**下拉菜單并切換到腳本日志視圖。 ![Your First iOS test program using UIAutomation framework](https://img.kancloud.cn/80/5c/805c95d37f75d375c507985722e1c892_142x78.png "Your First iOS test program using UIAutomation framework") 您將看到錄制的腳本。 ![Your First iOS test program using UIAutomation framework](https://img.kancloud.cn/57/f5/57f50518d8936ba70acb05cae188d937_584x354.png "Your First iOS test program using UIAutomation framework") 8. **播放腳本** 按下**播放**按鈕,腳本運行,您可以在出現日志后停止腳本。 ![Your First iOS test program using UIAutomation framework](https://img.kancloud.cn/3d/0c/3d0c4a400020966ee7bca1da36a27509_595x322.png "Your First iOS test program using UIAutomation framework") ***使用 OCUnit 框架創建 iOS 測試程序*** 1. 啟動 Xcode IDE,添加**單元測試包**目標 ![Your First iOS test program using UIAutomation framework](https://img.kancloud.cn/5e/4d/5e4dca2c42b6f9199f474ee330f4b266_679x463.png "Your First iOS test program using UIAutomation framework") 2. 如下圖所示,寫上新的單元測試捆綁包的名稱,然后單擊**完成** 3. 使單元測試成為活動目標 ![Your First iOS test program using UIAutomation framework](https://img.kancloud.cn/8c/c4/8cc4b35e983a0b4fb1840e65672741ea_344x378.png "Your First iOS test program using UIAutomation framework") 4. 為測試課程添加組 ![Your First iOS test program using UIAutomation framework](https://img.kancloud.cn/75/d4/75d4e4e83d3259da33a4df43af0cceca_465x306.png "Your First iOS test program using UIAutomation framework") 5. 添加單元測試類 ![Your First iOS test program using UIAutomation framework](https://img.kancloud.cn/96/ef/96ef1e7cb9e772cca5742125d274e66e_539x433.png "Your First iOS test program using UIAutomation framework") 6. 現在開始您的工具 ![Your First iOS test program using UIAutomation framework](https://img.kancloud.cn/ff/0a/ff0a72f10ce053d5c2381d985e9f9fa7_392x339.png "Your First iOS test program using UIAutomation framework") OCUnit 使用 Objective-C 語言創建測試程序。 開發人員必須了解這種語言。 ## 源代碼示例 本文包含一些源代碼示例。 它們可以幫助您更清楚,快速地理解本教程。 [UIAutomationSample](https://drive.google.com/uc?export=download&id=0B_vqvT0ovzHcalpPZE5RbXExQm8) UIAutomation 演示的測試腳本。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看