{"id":655,"date":"2025-05-29T10:39:34","date_gmt":"2025-06-05T03:34:34","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=655"},"modified":"2025-06-05T10:39:34","modified_gmt":"2025-06-05T03:34:34","slug":"firebase-xctest-%e4%b8%8a%e5%82%b3%e7%ad%86%e8%a8%98","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/swift\/firebase-xctest-%e4%b8%8a%e5%82%b3%e7%ad%86%e8%a8%98\/","title":{"rendered":"2025 \u6700\u65b0 Firebase XCTest \u4e0a\u50b3\u8207\u932f\u8aa4\u6392\u9664\u6307\u5357"},"content":{"rendered":"<h2>\u932f\u8aa4\u89e3\u6c7a\u8868<\/h2>\n<h3>could not find test host for XXX TEST_HOST evaluates to \u932f\u8aa4<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/Firebase-XCTest-1.png\" alt=\"\u932f\u8aa4\u793a\u4f8b: could not find test host\" title=\"\"><\/p>\n<p>\u70ba\u4e86\u89e3\u6c7a\u300ccould not find test host\u300d\u7684\u932f\u8aa4\uff0c\u8acb\u5c07 Host Application \u8a2d\u7f6e\u70ba\u60a8\u7684\u5c08\u6848\uff0c\u800c\u4e0d\u662f Custom\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/Firebase-XCTest-3.png\" alt=\"Host Application \u8a2d\u7f6e\u70ba\u5c08\u6848\" title=\"\"><\/p>\n<h3>No Such module XXXX \u932f\u8aa4<\/h3>\n<p>\u5982\u679c\u60a8\u9047\u5230\u300cNo Such module XXXX\u300d\u7684\u932f\u8aa4\uff0c\u8acb\u522a\u9664\u539f\u6709\u7684 Tests\uff0c\u7136\u5f8c\u91cd\u65b0\u5275\u5efa\u4e00\u500b\u65b0\u7684\u6e2c\u8a66\u76ee\u9304\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/Firebase-XCTest-5.png\" alt=\"\u522a\u9664\u539f\u6709\u7684 Tests\" title=\"\"><br \/>\n<img decoding=\"async\" src=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/Firebase-XCTest-6.png\" alt=\"\u5275\u5efa\u65b0\u7684\u6e2c\u8a66\u76ee\u9304\" title=\"\"><br \/>\n<img decoding=\"async\" src=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/Firebase-XCTest-7.png\" alt=\"\u65b0\u7684\u6e2c\u8a66\u76ee\u9304\u793a\u4f8b\" title=\"\"><\/p>\n<h2>\u4e0a\u50b3\u6b65\u9a5f<\/h2>\n<h3>\u7372\u53d6 DerivedData \u8def\u5f91<\/h3>\n<p>\u8981\u7372\u53d6 DerivedData \u8def\u5f91\uff0c\u8acb\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u78bc\u66ff\u63db\u60a8\u7684\u5e33\u6236\u540d\u7a31\uff1a<\/p>\n<pre><code class=\"language-swift line-numbers\">\/Users\/&lt;your_account&gt;\/Library\/Developer\/Xcode\/DerivedData<\/code><\/pre>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/wp_editor_md_a48a28d568e2a19e1889a6217a02a98c.jpg\"><br \/>\n<img decoding=\"async\" src=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/wp_editor_md_a48a28d568e2a19e1889a6217a02a98c.jpg\" alt=\"DerivedData \u8def\u5f91\u793a\u4f8b\" title=\"\"><\/a><\/p>\n<p>\u5728\u8a72\u76ee\u9304\u4e0b\uff0c\u60a8\u6703\u770b\u5230\u5169\u500b\u6a94\u6848\u3002<\/p>\n<h3>\u7372\u53d6 xctestrun \u540d\u7a31<\/h3>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u78bc\u7372\u53d6 xctestrun \u540d\u7a31\uff1a<\/p>\n<pre><code class=\"language-swift line-numbers\">Doughpack_iphoneos14.2-arm64-armv7.xctestrun<\/code><\/pre>\n<h3>\u58d3\u7e2e\u6a94\u6848<\/h3>\n<p>\u5728\u4e0a\u50b3\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u5c07\u9019\u5169\u500b\u6a94\u6848\u58d3\u7e2e\u3002<\/p>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/wp_editor_md_40fc629a1b0855404bbe015290233670.jpg\"><br \/>\n<img decoding=\"async\" src=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/wp_editor_md_40fc629a1b0855404bbe015290233670.jpg\" alt=\"\u58d3\u7e2e\u6a94\u6848\u793a\u4f8b\" title=\"\"><\/a><\/p>\n<h3>\u7372\u53d6\u624b\u6a5f ID<\/h3>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u7372\u53d6\u60a8\u7684\u624b\u6a5f ID\uff1a<\/p>\n<pre><code class=\"language-swift line-numbers\">instruments -s devices<\/code><\/pre>\n<p>\u60a8\u5c07\u6703\u7372\u5f97\u50cf\u662f <code>00008020-0019495814DA002E<\/code> \u7684\u5be6\u9ad4\u624b\u6a5f ID\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/Firebase-XCTest-8.png\" alt=\"\u624b\u6a5f ID \u793a\u4f8b\" title=\"\"><\/p>\n<h3>xcodebuild test-without-building \u6e2c\u8a66\u6307\u4ee4<\/h3>\n<h4>\u5b98\u7db2\u7bc4\u4f8b<\/h4>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u904b\u884c\u6e2c\u8a66\uff0c\u4e0d\u9032\u884c\u7de8\u8b6f\uff1a<\/p>\n<pre><code class=\"language-swift line-numbers\">xcodebuild test-without-building \\\n    -xctestrun \"Derived Data\/Build\/Products\/YourApp.xctestrun\" \\\n    -destination id=your-phone-id\n<\/code><\/pre>\n<h4>\u7bc4\u4f8b\u53c3\u6578<\/h4>\n<p>\u60a8\u9700\u8981\u7d44\u5408 xctestrun \u540d\u7a31\u548c\u624b\u6a5f ID\uff1a<\/p>\n<pre><code class=\"language-swift line-numbers\">xcodebuild test-without-building  -xctestrun \/Users\/steven\/Library\/Developer\/Xcode\/DerivedData\/Doughpack-dptltxsaexugdqeabkhmhyousmli\/Build\/Products\/Doughpack_iphoneos14.2-arm64-armv7.xctestrun  -destination id=00008020-0019495814DA002E\n<\/code><\/pre>\n<h3>Firebase XCTest \u4e0a\u50b3<\/h3>\n<p>\u5c07\u525b\u525b\u58d3\u7e2e\u7684\u6a94\u6848\u4e0a\u50b3\u5230 Firebase\u3002<\/p>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/wp_editor_md_40fc629a1b0855404bbe015290233670.jpg\"><br \/>\n<img decoding=\"async\" src=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/wp_editor_md_40fc629a1b0855404bbe015290233670.jpg\" alt=\"\u4e0a\u50b3\u6a94\u6848\u793a\u4f8b\" title=\"\"><\/a><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/Firebase-XCTest-9.png\" alt=\"Firebase \u4e0a\u50b3\u754c\u9762\" title=\"\"><br \/>\n<img decoding=\"async\" src=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/Firebase-XCTest-10.png\" alt=\"\u4e0a\u50b3\u9032\u5ea6\" title=\"\"><br \/>\n<img decoding=\"async\" src=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/Firebase-XCTest-11.png\" alt=\"\u4e0a\u50b3\u5b8c\u6210\" title=\"\"><br \/>\n<img decoding=\"async\" src=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/Firebase-XCTest-12.png\" alt=\"\u6e2c\u8a66\u7d50\u679c\" title=\"\"><br \/>\n<img decoding=\"async\" src=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/Firebase-XCTest-13.png\" alt=\"\u6e2c\u8a66\u7d50\u679c\u8a73\u7d30\" title=\"\"><br \/>\n<img decoding=\"async\" src=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/Firebase-XCTest-14.png\" alt=\"\u6e2c\u8a66\u7d50\u679c\u5206\u6790\" title=\"\"><br \/>\n<img decoding=\"async\" src=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/Firebase-XCTest-15.png\" alt=\"\u6e2c\u8a66\u7d50\u679c\u5716\u8868\" title=\"\"><br \/>\n<img decoding=\"async\" src=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/Firebase-XCTest-16.png\" alt=\"\u6e2c\u8a66\u8a73\u7d30\u5831\u544a\" title=\"\"><br \/>\n<img decoding=\"async\" src=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/Firebase-XCTest-17.png\" alt=\"\u6e2c\u8a66\u7d50\u679c\u7e3d\u7d50\" title=\"\"><br \/>\n<img decoding=\"async\" src=\"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/Firebase-XCTest-18.png\" alt=\"\u6e2c\u8a66\u7d50\u679c\u9801\u9762\" title=\"\"><\/p>\n<p>\u6ce8\u610f\uff1a\u5982\u679c\u60a8\u9047\u5230 Test Lab \u5931\u6557\u7684\u60c5\u6cc1\uff0c\u53ef\u80fd\u662f\u7531\u65bc Firebase \u5c1a\u672a\u652f\u6301\u60a8\u6240\u4f7f\u7528\u7684 Xcode \u7248\u672c\uff08\u5982 Xcode 12\uff09\u3002<\/p>\n<h2>\u5e38\u898b\u554f\u984c\u89e3\u7b54\uff08Q&#038;A\uff09<\/h2>\n<h3>1. \u5982\u4f55\u89e3\u6c7a Firebase XCTest \u7684\u5e38\u898b\u932f\u8aa4\uff1f<\/h3>\n<p>\u5982\u679c\u60a8\u9047\u5230\u932f\u8aa4\uff0c\u53ef\u4ee5\u53c3\u8003\u672c\u6587\u4e2d\u7684\u932f\u8aa4\u89e3\u6c7a\u8868\uff0c\u901a\u5e38\u53ea\u9700\u78ba\u8a8d Host Application \u548c\u6e2c\u8a66\u6a94\u6848\u7684\u6b63\u78ba\u6027\u5373\u53ef\u89e3\u6c7a\u554f\u984c\u3002<\/p>\n<h3>2. \u5982\u4f55\u7372\u53d6\u624b\u6a5f ID \u4ee5\u4fbf\u65bc\u6e2c\u8a66\uff1f<\/h3>\n<p>\u60a8\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4 `instruments -s devices` \u4f86\u7372\u53d6\u9023\u63a5\u8a2d\u5099\u7684 ID\uff0c\u9019\u662f\u9032\u884c\u96f2\u7aef\u6e2c\u8a66\u6240\u5fc5\u9808\u7684\u3002<\/p>\n<h3>3. Firebase XCTest \u4e0a\u50b3\u5f8c\uff0c\u5982\u4f55\u67e5\u770b\u6e2c\u8a66\u7d50\u679c\uff1f<\/h3>\n<p>\u4e0a\u50b3\u5b8c\u6210\u5f8c\uff0c\u60a8\u5c07\u80fd\u5920\u5728 Firebase \u63a7\u5236\u53f0\u4e2d\u67e5\u770b\u6e2c\u8a66\u7d50\u679c\uff0c\u5305\u62ec\u8a73\u7d30\u7684\u5831\u544a\u548c\u5206\u6790\u5716\u8868\u3002<\/p>\n<p>&#8212;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u932f\u8aa4\u89e3\u6c7a\u8868 could not find test&#8230;<\/p>\n","protected":false},"author":1,"featured_media":673,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"aside","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5],"tags":[],"class_list":["post-655","post","type-post","status-publish","format-aside","has-post-thumbnail","hentry","category-swift","post_format-post-format-aside"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2020\/11\/Firebase-XCTest-1.png","jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pcFK27-az","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/comments?post=655"}],"version-history":[{"count":3,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/655\/revisions"}],"predecessor-version":[{"id":7580,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/655\/revisions\/7580"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media\/673"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=655"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}