開始使用 Firebase Test Lab iOS 版
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Firebase Test Lab 可讓您在各種裝置和設定上測試應用程式品質。本指南將概略介紹 Test Lab 的重要概念、iOS 產品,以及如何開始測試。
如要瞭解 Test Lab 配額和價格方案,請參閱「用量、配額和價格」。
重要概念和詞彙
針對所選裝置和設定執行測試或一組測試案例時,Test Lab 會對應用程式執行批次測試,然後以測試矩陣的形式顯示結果。
裝置 × 測試執行次數 = 測試矩陣
- 裝置
- 您用來執行測試的實體或虛擬裝置 (僅限 Android),例如手機、平板電腦或穿戴式裝置。測試矩陣中的裝置會依據裝置型號、作業系統版本、螢幕方向和語言代碼 (也稱為地理位置和語言設定) 識別。
- 測試、測試執行
- 要在裝置上執行的測試 (或一組測試案例)。您可以在每個裝置上執行一項測試,也可以選擇將測試分片,並在不同裝置上執行測試案例。
- 測試矩陣
- 包含測試執行作業的狀態和測試結果。如果矩陣中的任何測試執行作業失敗,整個矩陣就會失敗。
步驟 1:準備要上傳至 Test Lab 的測試
您可以使用 Test Lab 執行下列測試。請注意,所有測試類型在實體裝置上最多可執行 45 分鐘,且任何未攔截的例外狀況都會導致測試失敗。
XCTest (包括 XCUITests):您使用 XCTest 架構編寫的單元測試。如需修改 XCTest 以使用 Test Lab 執行的操作說明,請參閱「建立 XCTest」。
遊戲迴圈測試:這項測試會使用「試玩模式」模擬遊戲應用程式中的玩家動作。這是快速且可擴充的方式,可驗證遊戲是否能為使用者帶來良好體驗。選擇執行遊戲迴圈測試時,您可以:
如需瞭解如何在 Test Lab 中執行測試,請參閱「執行遊戲迴圈測試」。
您可以選擇下列工具來執行測試:
您可以在Firebase控制台上傳應用程式,並從任何位置啟動測試。如需這項工具的操作說明,請參閱「使用 Firebase 控制台進行測試」一文。
gcloud 指令列介面 (CLI) 可讓您從指令列以互動方式執行測試,也很適合用於編寫指令碼,做為自動建構和測試程序的一部分。如需使用這項工具的操作說明,請參閱「使用 gcloud CLI 進行測試」。
在實體裝置上測試之前,請先在本機的模擬器上執行測試,確保測試行為符合預期。如需操作說明,請參閱「在本機測試」。
步驟 3:指定測試裝置
透過 Test Lab,您可以在 Google 資料中心託管的各種 iOS 裝置和機型上,針對應用程式執行測試。詳情請參閱「適用裝置」。
步驟 4:查看測試結果
無論您如何啟動測試,所有測試結果都會由 Test Lab 管理,並可線上查看。
測試結果摘要會自動儲存,並顯示在 Firebase 控制台中。其中包含測試最相關的資料,包括測試案例專屬影片、螢幕截圖、通過、失敗或結果不穩定的測試數量等。
原始測試結果包含測試記錄和應用程式故障詳細資料,並會自動儲存在 Google Cloud bucket 中。如果您指定 bucket,則須負責支付儲存空間費用。如果未指定值區,Test Lab 會為您建立一個,無須付費。
詳情請參閱「分析 Firebase Test Lab 結果」。
清除裝置資料
Google 非常重視應用程式資料的安全性。每次測試執行完畢後,我們都會遵循業界標準最佳做法,移除實體裝置上的應用程式資料並重設系統設定,確保裝置已準備好執行新測試。對於可使用自訂復原映像檔刷機的裝置,我們會進一步在測試執行期間刷機。
Test Lab 使用的虛擬裝置會在用完後刪除裝置執行個體,因此每次執行測試時都會使用新的虛擬裝置執行個體。
允許 Test Lab 裝置存取私人後端伺服器
部分行動應用程式需要與私有後端服務通訊,才能在測試期間正常運作。如果後端伺服器受到防火牆規則保護,您可以使用下列 IP 位址區塊,透過防火牆開啟路徑,允許 Test Lab 的實體和虛擬裝置存取。
行動廣告
Test Lab 提供可擴充的基礎架構,可自動執行應用程式測試,但很遺憾的是,惡意應用程式可能會濫用這項功能,以產生不當廣告收益。
如要解決這個問題,請採取下列行動:
Test Lab 裝置使用的 IP 位址
Test Lab 裝置產生的所有網路流量,都來自下列IP 位址區塊。您也可以在 gcloud CLI 中使用 gcloud beta firebase test ip-blocks list
指令
存取這份清單。這份清單平均每年更新一次。
平台和裝置類型 |
CIDR IP 位址區塊 |
Android 和 iOS 實體裝置、Arm 虛擬裝置 |
70.32.128.0/19 (2022 年 2 月新增)
108.177.6.0/23
108.177.18.192/26 (2022 年 2 月新增)
108.177.29.64/27 (2022 年 2 月擴展)
108.177.31.160/27 (2022 年 2 月新增)
199.36.156.8/29 (2022 年 2 月新增)
199.36.156.16/28 (2022 年 2 月新增)
209.85.131.0/27 (2022 年 2 月新增)
2001:4860:1008::/48 (2022 年 2 月新增)
2001:4860:1018::/48 (2022 年 2 月新增)
2001:4860:1019::/48 (2022 年 2 月新增)
2001:4860:1020::/48 (2022 年 2 月新增)
2001:4860:1022::/48 (2022 年 2 月新增)
70.32.128.48/28 (2024 年 4 月新增)
|
Android 虛擬裝置 (非 Arm) |
34.68.194.64/29 (2019 年 11 月新增)
34.69.234.64/29 (2019 年 11 月新增)
34.73.34.72/29 (2019 年 11 月新增)
34.73.178.72/29 (2019 年 11 月新增)
34.74.10.72/29 (2022 年 2 月新增)
34.136.2.136/29 (2022 年 2 月新增)
34.136.50.136/29 (2022 年 2 月新增)
34.145.234.144/29 (2022 年 2 月新增)
35.192.160.56/29
35.196.166.80/29
35.196.169.240/29
35.203.128.0/28
35.234.176.160/28
35.243.2.0/27 (2019 年 7 月新增)
35.245.243.240/29 (2022 年 2 月新增)
199.192.115.0/30
199.192.115.8/30
199.192.115.16/29
|
不再使用的裝置 IP 封鎖 |
74.125.122.32/29 (已於 2022 年 2 月移除)
216.239.44.24/29 (已於 2022 年 2 月移除)
|
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-16 (世界標準時間)。
[null,null,["上次更新時間:2025-08-16 (世界標準時間)。"],[],[],null,["\u003cbr /\u003e\n\nFirebase Test Lab lets you quality test your app on a range of devices and\nconfigurations. This guide provides an overview of Test Lab's key concepts,\niOS offerings, and instructions on how to start testing.\n\nFor information about Test Lab quotas and pricing plans, see\n[Usage, Quotas, and Pricing](../usage-quotas-pricing).\n\nKey concepts and terms\n\nWhen you run a test or a set of test cases against devices and configurations\nyou've selected, Test Lab runs the test against your app in a batch, then\ndisplays the results as a **test matrix**.\n\n**Devices × Test Executions = Test Matrix**\n\nDevice\n: A physical or virtual device (Android only) you run a test on, such as a\n phone, tablet, or wearable device. Devices in a test matrix are identified by\n device model, OS version, screen orientation, and locale (also known as\n geography and language settings).\n\nTest, test execution\n: A test (or a set of test cases) to be run on a device. You can run one test\n per device, or optionally shard the test and run its test cases on\n different devices.\n\nTest matrix\n: Contains the statuses and test results for your test executions. If any\n test execution in a matrix fails, the whole matrix fails.\n\n*** ** * ** ***\n\n**Step 1** : Prepare your test for uploading to Test Lab\n\nYou can run the following tests with Test Lab. Note that all test types can\nrun up to a maximum of 45 minutes on physical devices, and any uncaught\nexception will cause a test failure.\n\n- **XCTest (including XCUITests)** : A unit test you've written using the\n [XCTest framework](https://developer.apple.com/documentation/xctest).\n Visit [Create an XCTest](/docs/test-lab/ios/run-xctest) for instructions on modifying an\n XCTest to run with Test Lab.\n\n- **Game Loop test**: A test that uses a \"demo mode\" to\n simulate player actions in gaming apps. This is a fast and scalable way\n to verify that your game performs well for users. When you choose to run a\n Game Loop test, you can:\n\n - Write tests native to your game engine.\n\n - Avoid writing the same code for different UIs or testing\n frameworks.\n\n - Optionally create multiple loops to run in a single test execution. You\n can also organize loops by using labels so you can keep track of them and\n re-run specific loops.\n\n Visit [Run a Game Loop test](/docs/test-lab/ios/run-game-loop-test) for instructions on how to\n run your test in Test Lab.\n\n**Step 2**: Choose a tool to run your test\n\nYou can choose the following tools to run your test with:\n\n- The **Firebase console** lets you upload an\n app and initiate testing from anywhere. See\n [Test with the Firebase console](/docs/test-lab/ios/firebase-console)\n for instructions on using this tool.\n\n- The **gcloud command line interface (CLI)** enables you to run tests\n from the command line interactively, and is also well suited for scripting as\n part of your automated build and testing process. See [Test with the gcloud CLI](/docs/test-lab/ios/command-line)\n for instructions on using this tool.\n\n- Before testing on real devices, run your test **locally on a simulator** to\n make sure it behaves as intended. See\n [Test locally](/docs/test-lab/ios/test-locally) for instructions.\n\n**Step 3**: Specify testing devices\n\nWith Test Lab, you can run your test against your app on a wide range of iOS\ndevices and models hosted in a Google data center. To learn more, see\n[Available devices.](/docs/test-lab/ios/available-testing-devices)\n\n**Step 4**: Review test results\n\nRegardless of how you initiate your tests, all your test results are managed by\nTest Lab and can be viewed online.\n\nThe **test result summary** is\nautomatically stored and can be viewed in the Firebase console. It contains\nthe most relevant data for your test, including test case-specific videos,\nscreenshots, the number of tests that passed, failed, or got flaky results, and\nmore.\n\nThe **raw test results** contain test logs and app failure details, and is\nautomatically stored in a Google Cloud bucket. If you specify a bucket, you are\nresponsible for the cost of the storage. If you don't specify a bucket,\nTest Lab creates one for you at no cost.\n\nFor more details, see\n[Analyze Firebase Test Lab Results.](/docs/test-lab/analyzing-results)\n\nDevice cleanup\n\nGoogle takes the security of your app data very seriously. We follow\nindustry-standard best practices to remove app data and reset system settings\nfor physical devices after every test run to ensure that they are\nready to run new tests. For devices that we can flash with a custom recovery\nimage, we go one step further by flashing these devices between test runs.\n\nFor the virtual devices used by Test Lab, device instances are deleted after\nthey are used so that each test run uses a new virtual device instance.\n\n*** ** * ** ***\n\nAllowing Test Lab devices to access private backend servers\n\nSome mobile apps need to communicate with private backend services to function\ncorrectly during testing. If your backend servers are protected by firewall\nrules, you can allow access for Test Lab's physical and virtual devices by\nusing the [IP address blocks below](#ip-blocks) to open routes through your\nfirewall.\n\nMobile advertising\n\nTest Lab provides a scalable infrastructure that automates app testing, and\nunfortunately, this capability can be misused by malicious apps designed to\ngenerate fraudulent ad revenue.\n\nTo mitigate this issue:\n\n- If you use or work with third-party digital advertising providers\n (for example, ad networks or demand-side platforms),\n you're recommended to use test ads rather than real ads during app development\n and testing.\n\n- If you must use real ads in your test, notify the digital advertising\n providers you work with to filter out revenues and all corresponding traffic\n generated from Test Lab by using the\n [IP address blocks below](#ip-blocks). You don't need\n to notify Google-owned ad providers; Test Lab takes care of that for you.\n\nIP addresses used by Test Lab devices\n\nAll network traffic generated by Test Lab devices originates from the\nfollowing\n[IP address blocks](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation).\nYou can also access this list by using the\n`gcloud beta firebase test ip-blocks list`\n[command](https://cloud.google.com/sdk/gcloud/reference/beta/firebase/test/ip-blocks/list)\nin the [gcloud](https://cloud.google.com/sdk/gcloud) CLI. The list is updated on\naverage once a year.\n\n| Platform and device type | CIDR IP address block |\n|-------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Android and iOS physical devices, Arm virtual devices | 70.32.128.0/19 (added 02-2022) 108.177.6.0/23 108.177.18.192/26 (added 02-2022) 108.177.29.64/27 (expanded 02-2022) 108.177.31.160/27 (added 02-2022) 199.36.156.8/29 (added 02-2022) 199.36.156.16/28 (added 02-2022) 209.85.131.0/27 (added 02-2022) 2001:4860:1008::/48 (added 02-2022) 2001:4860:1018::/48 (added 02-2022) 2001:4860:1019::/48 (added 02-2022) 2001:4860:1020::/48 (added 02-2022) 2001:4860:1022::/48 (added 02-2022) 70.32.128.48/28 (added 04-2024) |\n| Android virtual devices (Non-Arm) | 34.68.194.64/29 (added 11-2019) 34.69.234.64/29 (added 11-2019) 34.73.34.72/29 (added 11-2019) 34.73.178.72/29 (added 11-2019) 34.74.10.72/29 (added 02-2022) 34.136.2.136/29 (added 02-2022) 34.136.50.136/29 (added 02-2022) 34.145.234.144/29 (added 02-2022) 35.192.160.56/29 35.196.166.80/29 35.196.169.240/29 35.203.128.0/28 35.234.176.160/28 35.243.2.0/27 (added 7-2019) 35.245.243.240/29 (added 02-2022) 199.192.115.0/30 199.192.115.8/30 199.192.115.16/29 |\n| Device IP-blocks no longer being used | 74.125.122.32/29 (removed 02-2022) 216.239.44.24/29 (removed 02-2022) |"]]