

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 在 AWS Device Farm 中对 XCTest UI 测试进行故障排除
<a name="troubleshooting-xctest-ui"></a>

以下主题列出了在上传 XCTest UI 测试期间出现的错误消息并推荐了解决方法来解决每个错误。

**注意**  
以下说明基于 Linux x86\$164 和 Mac。

## XCTEST\$1UI\$1TEST\$1PACKAGE\$1UNZIP\$1FAILED
<a name="XCTEST_UI_TEST_PACKAGE_UNZIP_FAILED"></a>

如果您看到以下消息，请执行以下步骤来修复此问题。

`We could not open your test IPA file. Please verify that the file is valid and try again.`

确保您可以解压应用程序包，而不会出现错误。在以下示例中，程序包的名称为 **swift-sample-UI.ipa**。

1. 将您的测试程序包复制到工作目录，然后运行以下命令：

   ```
   $ unzip swift-sample-UI.ipa
   ```

1. 成功解压缩程序包后，您可以通过运行以下命令找到工作目录树结构：

   ```
   $ tree .
   ```

   有效的 iOS 应用程序包应生成类似以下内容的输出：

   ```
   .
   `-- Payload (directory)
           `-- swift-sampleUITests-Runner.app (directory)
                         |-- Info.plist
                         |-- Plugins (directory)
                         |       `swift-sampleUITests.xctest (directory)
                         |                       |-- Info.plist
                         |                       `-- (any other files)
                         `-- (any other files)
   ```

   有关更多信息，请参阅 [将 iOS XCTest 用户界面与 Device Farm 集成](test-types-ios-xctest-ui.md)。

## XCTEST\$1UI\$1TEST\$1PACKAGE\$1PAYLOAD\$1DIR\$1MISSING
<a name="XCTEST_UI_TEST_PACKAGE_PAYLOAD_DIR_MISSING"></a>

如果您看到以下消息，请执行以下步骤来修复此问题。

`We could not find the Payload directory inside your test package. Please unzip your test package, verify that the Payload directory is inside the package, and try again. `

在以下示例中，程序包的名称为 **swift-sample-UI.ipa**。

1. 将您的测试程序包复制到工作目录，然后运行以下命令：

   ```
   $ unzip swift-sample-UI.ipa
   ```

1. 成功解压缩程序包后，您可以通过运行以下命令找到工作目录树结构：

   ```
   $ tree .
   ```

   如果 XCTest UI 程序包有效，您将在工作目录中找到 *Payload* 目录。

   ```
   .
   `-- Payload (directory)
           `-- swift-sampleUITests-Runner.app (directory)
                         |-- Info.plist
                         |-- Plugins (directory)
                         |       `swift-sampleUITests.xctest (directory)
                         |                       |-- Info.plist
                         |                       `-- (any other files)
                         `-- (any other files)
   ```

   有关更多信息，请参阅 [将 iOS XCTest 用户界面与 Device Farm 集成](test-types-ios-xctest-ui.md)。

## XCTEST\$1UI\$1TEST\$1PACKAGE\$1APP\$1DIR\$1MISSING
<a name="XCTEST_UI_TEST_PACKAGE_APP_DIR_MISSING"></a>

如果您看到以下消息，请执行以下步骤来修复此问题。

`We could not find the .app directory inside the Payload directory. Please unzip your test package and then open the Payload directory, verify that the .app directory is inside the directory, and try again.`

在以下示例中，程序包的名称为 **swift-sample-UI.ipa**。

1. 将您的测试程序包复制到工作目录，然后运行以下命令：

   ```
   $ unzip swift-sample-UI.ipa
   ```

1. 成功解压缩程序包后，您可以通过运行以下命令找到工作目录树结构：

   ```
   $ tree .
   ```

   如果 XCTest UI 程序包有效，您将在 *Payload* 目录中找到 *.app* 目录 (例如我们示例中的 *swift-sampleUITests-Runner.app*)。

   ```
   .
   `-- Payload (directory)
           `-- swift-sampleUITests-Runner.app (directory)
                         |-- Info.plist
                         |-- Plugins (directory)
                         |       `swift-sampleUITests.xctest (directory)
                         |                       |-- Info.plist
                         |                       `-- (any other files)
                         `-- (any other files)
   ```

   有关更多信息，请参阅 [将 iOS XCTest 用户界面与 Device Farm 集成](test-types-ios-xctest-ui.md)。

## XCTEST\$1UI\$1TEST\$1PACKAGE\$1PLUGINS\$1DIR\$1MISSING
<a name="XCTEST_UI_TEST_PACKAGE_PLUGINS_DIR_MISSING"></a>

如果您看到以下消息，请执行以下步骤来修复此问题。

`We could not find the Plugins directory inside the .app directory. Please unzip your test package and then open the .app directory, verify that the Plugins directory is inside the directory, and try again.`

在以下示例中，程序包的名称为 **swift-sample-UI.ipa**。

1. 将您的测试程序包复制到工作目录，然后运行以下命令：

   ```
   $ unzip swift-sample-UI.ipa
   ```

1. 成功解压缩程序包后，您可以通过运行以下命令找到工作目录树结构：

   ```
   $ tree .
   ```

   如果 XCTest UI 程序包有效，您将在 *.app* 目录中找到 *Plugins* 目录。在我们的示例中，该目录名为 *swift-sampleUITests-Runner.app*。

   ```
   .
   `-- Payload (directory)
           `-- swift-sampleUITests-Runner.app (directory)
                         |-- Info.plist
                         |-- Plugins (directory)
                         |       `swift-sampleUITests.xctest (directory)
                         |                       |-- Info.plist
                         |                       `-- (any other files)
                         `-- (any other files)
   ```

   有关更多信息，请参阅 [将 iOS XCTest 用户界面与 Device Farm 集成](test-types-ios-xctest-ui.md)。

## XCTEST\$1UI\$1TEST\$1PACKAGE\$1XCTEST\$1DIR\$1MISSING\$1IN\$1PLUGINS\$1DIR
<a name="XCTEST_UI_TEST_PACKAGE_XCTEST_DIR_MISSING_IN_PLUGINS_DIR"></a>

如果您看到以下消息，请执行以下步骤来修复此问题。

`We could not find the .xctest directory inside the plugins directory. Please unzip your test package and then open the plugins directory, verify that the .xctest directory is inside the directory, and try again.`

在以下示例中，程序包的名称为 **swift-sample-UI.ipa**。

1. 将您的测试程序包复制到工作目录，然后运行以下命令：

   ```
   $ unzip swift-sample-UI.ipa
   ```

1. 成功解压缩程序包后，您可以通过运行以下命令找到工作目录树结构：

   ```
   $ tree .
   ```

   如果 XCTest UI 程序包有效，您将在 *Plugins* 目录中找到 *.xctest* 目录。在我们的示例中，该目录名为 *swift-sampleUITests.xctest*。

   ```
   .
   `-- Payload (directory)
           `-- swift-sampleUITests-Runner.app (directory)
                         |-- Info.plist
                         |-- Plugins (directory)
                         |       `swift-sampleUITests.xctest (directory)
                         |                       |-- Info.plist
                         |                       `-- (any other files)
                         `-- (any other files)
   ```

   有关更多信息，请参阅 [将 iOS XCTest 用户界面与 Device Farm 集成](test-types-ios-xctest-ui.md)。

## XCTEST\$1UI\$1TEST\$1PACKAGE\$1PLIST\$1FILE\$1MISSING
<a name="XCTEST_UI_TEST_PACKAGE_PLIST_FILE_MISSING"></a>

如果您看到以下消息，请执行以下步骤来修复此问题。

`We could not find the Info.plist file inside the .app directory. Please unzip your test package and then open the .app directory, verify that the Info.plist file is inside the directory, and try again.`

在以下示例中，程序包的名称为 **swift-sample-UI.ipa**。

1. 将您的测试程序包复制到工作目录，然后运行以下命令：

   ```
   $ unzip swift-sample-UI.ipa
   ```

1. 成功解压缩程序包后，您可以通过运行以下命令找到工作目录树结构：

   ```
   $ tree .
   ```

   如果 XCTest UI 程序包有效，您将在 *.app* 目录中找到 *Info.plist* 文件。在下面的示例中，该目录名为 *swift-sampleUITests-Runner.app*。

   ```
   .
   `-- Payload (directory)
           `-- swift-sampleUITests-Runner.app (directory)
                         |-- Info.plist
                         |-- Plugins (directory)
                         |       `swift-sampleUITests.xctest (directory)
                         |                       |-- Info.plist
                         |                       `-- (any other files)
                         `-- (any other files)
   ```

   有关更多信息，请参阅 [将 iOS XCTest 用户界面与 Device Farm 集成](test-types-ios-xctest-ui.md)。

## XCTEST\$1UI\$1TEST\$1PACKAGE\$1PLIST\$1FILE\$1MISSING\$1IN\$1XCTEST\$1DIR
<a name="XCTEST_UI_TEST_PACKAGE_PLIST_FILE_MISSING_IN_XCTEST_DIR"></a>

如果您看到以下消息，请执行以下步骤来修复此问题。

`We could not find the Info.plist file inside the .xctest directory. Please unzip your test package and then open the .xctest directory, verify that the Info.plist file is inside the directory, and try again.`

在以下示例中，程序包的名称为 **swift-sample-UI.ipa**。

1. 将您的测试程序包复制到工作目录，然后运行以下命令：

   ```
   $ unzip swift-sample-UI.ipa
   ```

1. 成功解压缩程序包后，您可以通过运行以下命令找到工作目录树结构：

   ```
   $ tree .
   ```

   如果 XCTest UI 程序包有效，您将在 *.xctest* 目录中找到 *Info.plist* 文件。在下面的示例中，该目录名为 *swift-sampleUITests.xctest*。

   ```
   .
   `-- Payload (directory)
           `-- swift-sampleUITests-Runner.app (directory)
                         |-- Info.plist
                         |-- Plugins (directory)
                         |       `swift-sampleUITests.xctest (directory)
                         |                       |-- Info.plist
                         |                       `-- (any other files)
                         `-- (any other files)
   ```

   有关更多信息，请参阅 [将 iOS XCTest 用户界面与 Device Farm 集成](test-types-ios-xctest-ui.md)。

## XCTEST\$1UI\$1TEST\$1PACKAGE\$1CPU\$1ARCHITECTURE\$1VALUE\$1MISSING
<a name="XCTEST_UI_TEST_PACKAGE_CPU_ARCHITECTURE_VALUE_MISSING"></a>

如果您看到以下消息，请执行以下步骤来修复此问题。

`We could not the CPU architecture value in the Info.plist file. Please unzip your test package and then open the Info.plist file inside the .app directory, verify that the key "UIRequiredDeviceCapabilities" is specified, and try again.`

在以下示例中，程序包的名称为 **swift-sample-UI.ipa**。

1. 将您的测试程序包复制到工作目录，然后运行以下命令：

   ```
   $ unzip swift-sample-UI.ipa
   ```

1. 成功解压缩程序包后，您可以通过运行以下命令找到工作目录树结构：

   ```
   $ tree .
   ```

   您应该在 *.app* 目录 (例如我们示例中的 *swift-sampleUITests-Runner.app*) 中找到 *Info.plist* 文件：

   ```
   .
   `-- Payload (directory)
           `-- swift-sampleUITests-Runner.app (directory)
                         |-- Info.plist
                         |-- Plugins (directory)
                         |       `swift-sampleUITests.xctest (directory)
                         |                       |-- Info.plist
                         |                       `-- (any other files)
                         `-- (any other files)
   ```

1. 要查找 CPU 架构值，您可以使用 Xcode 或 Python 打开 Info.plist。

   对于 Python，您可以通过运行以下命令来安装 biplist 模块：

   ```
   $ pip install biplist
   ```

1. 接下来，打开 Python 并运行以下命令：

   ```
   import biplist
   info_plist = biplist.readPlist('Payload/swift-sampleUITests-Runner.app/Info.plist') 
   print info_plist['UIRequiredDeviceCapabilities']
   ```

   有效的 XCtest UI 程序包应生成类似以下内容的输出：

   ```
   ['armv7']
   ```

   有关更多信息，请参阅 [将 iOS XCTest 用户界面与 Device Farm 集成](test-types-ios-xctest-ui.md)。

## XCTEST\$1UI\$1TEST\$1PACKAGE\$1PLATFORM\$1VALUE\$1MISSING
<a name="XCTEST_UI_TEST_PACKAGE_PLATFORM_VALUE_MISSING"></a>

如果您看到以下消息，请执行以下步骤来修复此问题。

`We could not find the platform value in the Info.plist. Please unzip your test package and then open the Info.plist file inside the .app directory, verify that the key "CFBundleSupportedPlatforms" is specified, and try again.`

在以下示例中，程序包的名称为 **swift-sample-UI.ipa**。

1. 将您的测试程序包复制到工作目录，然后运行以下命令：

   ```
   $ unzip swift-sample-UI.ipa
   ```

1. 成功解压缩程序包后，您可以通过运行以下命令找到工作目录树结构：

   ```
   $ tree .
   ```

   您应该在 *.app* 目录 (例如我们示例中的 *swift-sampleUITests-Runner.app*) 中找到 *Info.plist* 文件：

   ```
   .
   `-- Payload (directory)
           `-- swift-sampleUITests-Runner.app (directory)
                         |-- Info.plist
                         |-- Plugins (directory)
                         |       `swift-sampleUITests.xctest (directory)
                         |                       |-- Info.plist
                         |                       `-- (any other files)
                         `-- (any other files)
   ```

1. 要查找平台值，您可以使用 Xcode 或 Python 打开 Info.plist。

   对于 Python，您可以通过运行以下命令来安装 biplist 模块：

   ```
   $ pip install biplist
   ```

1. 接下来，打开 Python 并运行以下命令：

   ```
   import biplist
   info_plist = biplist.readPlist('Payload/swift-sampleUITests-Runner.app/Info.plist')
   print info_plist['CFBundleSupportedPlatforms']
   ```

   有效的 XCtest UI 程序包应生成类似以下内容的输出：

   ```
   ['iPhoneOS']
   ```

   有关更多信息，请参阅 [将 iOS XCTest 用户界面与 Device Farm 集成](test-types-ios-xctest-ui.md)。

## XCTEST\$1UI\$1TEST\$1PACKAGE\$1WRONG\$1PLATFORM\$1DEVICE\$1VALUE
<a name="XCTEST_UI_TEST_PACKAGE_WRONG_PLATFORM_DEVICE_VALUE"></a>

如果您看到以下消息，请执行以下步骤来修复此问题。

`We found the platform device value was wrong in the Info.plist file. Please unzip your test package and then open the Info.plist file inside the .app directory, verify that the value of the key "CFBundleSupportedPlatforms" does not contain the keyword "simulator", and try again.`

在以下示例中，程序包的名称为 **swift-sample-UI.ipa**。

1. 将您的测试程序包复制到工作目录，然后运行以下命令：

   ```
   $ unzip swift-sample-UI.ipa
   ```

1. 成功解压缩程序包后，您可以通过运行以下命令找到工作目录树结构：

   ```
   $ tree .
   ```

   您应该在 *.app* 目录 (例如我们示例中的 *swift-sampleUITests-Runner.app*) 中找到 *Info.plist* 文件：

   ```
   .
   `-- Payload (directory)
           `-- swift-sampleUITests-Runner.app (directory)
                         |-- Info.plist
                         |-- Plugins (directory)
                         |       `swift-sampleUITests.xctest (directory)
                         |                       |-- Info.plist
                         |                       `-- (any other files)
                         `-- (any other files)
   ```

1. 要查找平台值，您可以使用 Xcode 或 Python 打开 Info.plist。

   对于 Python，您可以通过运行以下命令来安装 biplist 模块：

   ```
   $ pip install biplist
   ```

1. 接下来，打开 Python 并运行以下命令：

   ```
   import biplist
   info_plist = biplist.readPlist('Payload/swift-sampleUITests-Runner.app/Info.plist')
   print info_plist['CFBundleSupportedPlatforms']
   ```

   有效的 XCtest UI 程序包应生成类似以下内容的输出：

   ```
   ['iPhoneOS']
   ```

   如果 XCTest UI 程序包有效，则该值不应包含关键字 `simulator`。

   有关更多信息，请参阅 [将 iOS XCTest 用户界面与 Device Farm 集成](test-types-ios-xctest-ui.md)。

## XCTEST\$1UI\$1TEST\$1PACKAGE\$1FORM\$1FACTOR\$1VALUE\$1MISSING
<a name="XCTEST_UI_TEST_PACKAGE_FORM_FACTOR_VALUE_MISSING"></a>

如果您看到以下消息，请执行以下步骤来修复此问题。

`We could not the form factor value in the Info.plist. Please unzip your test package and then open the Info.plist file inside the .app directory, verify that the key "UIDeviceFamily" is specified, and try again.`

在以下示例中，程序包的名称为 **swift-sample-UI.ipa**。

1. 将您的测试程序包复制到工作目录，然后运行以下命令：

   ```
   $ unzip swift-sample-UI.ipa
   ```

1. 成功解压缩程序包后，您可以通过运行以下命令找到工作目录树结构：

   ```
   $ tree .
   ```

   您应该在 *.app* 目录 (例如我们示例中的 *swift-sampleUITests-Runner.app*) 中找到 *Info.plist* 文件：

   ```
   .
   `-- Payload (directory)
           `-- swift-sampleUITests-Runner.app (directory)
                         |-- Info.plist
                         |-- Plugins (directory)
                         |       `swift-sampleUITests.xctest (directory)
                         |                       |-- Info.plist
                         |                       `-- (any other files)
                         `-- (any other files)
   ```

1. 要查找外形规格值，您可以使用 Xcode 或 Python 打开 Info.plist。

   对于 Python，您可以通过运行以下命令来安装 biplist 模块：

   ```
   $ pip install biplist
   ```

1. 接下来，打开 Python 并运行以下命令：

   ```
   import biplist
   info_plist = biplist.readPlist('Payload/swift-sampleUITests-Runner.app/Info.plist')
   print info_plist['UIDeviceFamily']
   ```

   有效的 XCtest UI 程序包应生成类似以下内容的输出：

   ```
   [1, 2]
   ```

   有关更多信息，请参阅 [将 iOS XCTest 用户界面与 Device Farm 集成](test-types-ios-xctest-ui.md)。

## XCTEST\$1UI\$1TEST\$1PACKAGE\$1PACKAGE\$1NAME\$1VALUE\$1MISSING
<a name="XCTEST_UI_TEST_PACKAGE_PACKAGE_NAME_VALUE_MISSING"></a>

如果您看到以下消息，请执行以下步骤来修复此问题。

`We could not find the package name value in the Info.plist file. Please unzip your test package and then open the Info.plist file inside the .app directory, verify that the key "CFBundleIdentifier" is specified, and try again.`

在以下示例中，程序包的名称为 **swift-sample-UI.ipa**。

1. 将您的测试程序包复制到工作目录，然后运行以下命令：

   ```
   $ unzip swift-sample-UI.ipa
   ```

1. 成功解压缩程序包后，您可以通过运行以下命令找到工作目录树结构：

   ```
   $ tree .
   ```

   您应该在 *.app* 目录 (例如我们示例中的 *swift-sampleUITests-Runner.app*) 中找到 *Info.plist* 文件：

   ```
   .
   `-- Payload (directory)
           `-- swift-sampleUITests-Runner.app (directory)
                         |-- Info.plist
                         |-- Plugins (directory)
                         |       `swift-sampleUITests.xctest (directory)
                         |                       |-- Info.plist
                         |                       `-- (any other files)
                         `-- (any other files)
   ```

1. 要查找程序包名称值，您可以使用 Xcode 或 Python 打开 Info.plist。

   对于 Python，您可以通过运行以下命令来安装 biplist 模块：

   ```
   $ pip install biplist
   ```

1. 接下来，打开 Python 并运行以下命令：

   ```
   import biplist
   info_plist = biplist.readPlist('Payload/swift-sampleUITests-Runner.app/Info.plist')
   print info_plist['CFBundleIdentifier']
   ```

   有效的 XCtest UI 程序包应生成类似以下内容的输出：

   ```
   com.apple.test.swift-sampleUITests-Runner
   ```

   有关更多信息，请参阅 [将 iOS XCTest 用户界面与 Device Farm 集成](test-types-ios-xctest-ui.md)。

## XCTEST\$1UI\$1TEST\$1PACKAGE\$1EXECUTABLE\$1VALUE\$1MISSING
<a name="XCTEST_UI_TEST_PACKAGE_EXECUTABLE_VALUE_MISSING"></a>

如果您看到以下消息，请执行以下步骤来修复此问题。

`We could not find the executable value in the Info.plist file. Please unzip your test package and then open the Info.plist file inside the .app directory, verify that the key "CFBundleExecutable" is specified, and try again.`

在以下示例中，程序包的名称为 **swift-sample-UI.ipa**。

1. 将您的测试程序包复制到工作目录，然后运行以下命令：

   ```
   $ unzip swift-sample-UI.ipa
   ```

1. 成功解压缩程序包后，您可以通过运行以下命令找到工作目录树结构：

   ```
   $ tree .
   ```

   您应该在 *.app* 目录 (例如我们示例中的 *swift-sampleUITests-Runner.app*) 中找到 *Info.plist* 文件：

   ```
   .
   `-- Payload (directory)
           `-- swift-sampleUITests-Runner.app (directory)
                         |-- Info.plist
                         |-- Plugins (directory)
                         |       `swift-sampleUITests.xctest (directory)
                         |                       |-- Info.plist
                         |                       `-- (any other files)
                         `-- (any other files)
   ```

1. 要查找可执行文件值，您可以使用 Xcode 或 Python 打开 Info.plist。

   对于 Python，您可以通过运行以下命令来安装 biplist 模块：

   ```
   $ pip install biplist
   ```

1. 接下来，打开 Python 并运行以下命令：

   ```
   import biplist
   info_plist = biplist.readPlist('Payload/swift-sampleUITests-Runner.app/Info.plist')
   print info_plist['CFBundleExecutable']
   ```

   有效的 XCtest UI 程序包应生成类似以下内容的输出：

   ```
   XCTRunner
   ```

   有关更多信息，请参阅 [将 iOS XCTest 用户界面与 Device Farm 集成](test-types-ios-xctest-ui.md)。

## XCTEST\$1UI\$1TEST\$1PACKAGE\$1TEST\$1PACKAGE\$1NAME\$1VALUE\$1MISSING
<a name="XCTEST_UI_TEST_PACKAGE_TEST_PACKAGE_NAME_VALUE_MISSING"></a>

如果您看到以下消息，请执行以下步骤来修复此问题。

`We could not find the package name value in the Info.plist file inside the .xctest directory. Please unzip your test package and then open the Info.plist file inside the .xctest directory, verify that the key "CFBundleIdentifier" is specified, and try again.`

在以下示例中，程序包的名称为 **swift-sample-UI.ipa**。

1. 将您的测试程序包复制到工作目录，然后运行以下命令：

   ```
   $ unzip swift-sample-UI.ipa
   ```

1. 成功解压缩程序包后，您可以通过运行以下命令找到工作目录树结构：

   ```
   $ tree .
   ```

   您应该在 *.app* 目录 (例如我们示例中的 *swift-sampleUITests-Runner.app*) 中找到 *Info.plist* 文件：

   ```
   .
   `-- Payload (directory)
           `-- swift-sampleUITests-Runner.app (directory)
                         |-- Info.plist
                         |-- Plugins (directory)
                         |       `swift-sampleUITests.xctest (directory)
                         |                       |-- Info.plist
                         |                       `-- (any other files)
                         `-- (any other files)
   ```

1. 要查找程序包名称值，您可以使用 Xcode 或 Python 打开 Info.plist。

   对于 Python，您可以通过运行以下命令来安装 biplist 模块：

   ```
   $ pip install biplist
   ```

1. 接下来，打开 Python 并运行以下命令：

   ```
   import biplist
   info_plist = biplist.readPlist('Payload/swift-sampleUITests-Runner.app/Plugins/swift-sampleUITests.xctest/Info.plist')
   print info_plist['CFBundleIdentifier']
   ```

   有效的 XCtest UI 程序包应生成类似以下内容的输出：

   ```
   com.amazon.swift-sampleUITests
   ```

   有关更多信息，请参阅 [将 iOS XCTest 用户界面与 Device Farm 集成](test-types-ios-xctest-ui.md)。

## XCTEST\$1UI\$1TEST\$1PACKAGE\$1TEST\$1EXECUTABLE\$1VALUE\$1MISSING
<a name="XCTEST_UI_TEST_PACKAGE_TEST_EXECUTABLE_VALUE_MISSING"></a>

如果您看到以下消息，请执行以下步骤来修复此问题。

`We could not find the executable value in the Info.plist file inside the .xctest directory. Please unzip your test package and then open the Info.plist file inside the .xctest directory, verify that the key "CFBundleExecutable" is specified, and try again.`

在以下示例中，程序包的名称为 **swift-sample-UI.ipa**。

1. 将您的测试程序包复制到工作目录，然后运行以下命令：

   ```
   $ unzip swift-sample-UI.ipa
   ```

1. 成功解压缩程序包后，您可以通过运行以下命令找到工作目录树结构：

   ```
   $ tree .
   ```

   您应该在 *.app* 目录 (例如我们示例中的 *swift-sampleUITests-Runner.app*) 中找到 *Info.plist* 文件：

   ```
   .
   `-- Payload (directory)
           `-- swift-sampleUITests-Runner.app (directory)
                         |-- Info.plist
                         |-- Plugins (directory)
                         |       `swift-sampleUITests.xctest (directory)
                         |                       |-- Info.plist
                         |                       `-- (any other files)
                         `-- (any other files)
   ```

1. 要查找可执行文件值，您可以使用 Xcode 或 Python 打开 Info.plist。

   对于 Python，您可以通过运行以下命令来安装 biplist 模块：

   ```
   $ pip install biplist
   ```

1. 接下来，打开 Python 并运行以下命令：

   ```
   import biplist
   info_plist = biplist.readPlist('Payload/swift-sampleUITests-Runner.app/Plugins/swift-sampleUITests.xctest/Info.plist')
   print info_plist['CFBundleExecutable']
   ```

   有效的 XCtest UI 程序包应生成类似以下内容的输出：

   ```
   swift-sampleUITests
   ```

   有关更多信息，请参阅 [将 iOS XCTest 用户界面与 Device Farm 集成](test-types-ios-xctest-ui.md)。

## XCTEST\$1UI\$1TEST\$1PACKAGE\$1MULTIPLE\$1APP\$1DIRS
<a name="XCTEST_UI_TEST_PACKAGE_MULTIPLE_APP_DIRS"></a>

如果您看到以下消息，请执行以下步骤来修复此问题。

`We found multiple .app directories inside your test package. Please unzip your test package, verify that only a single .app directory is present inside the package, then try again.`

1. 将您的测试程序包复制到工作目录，然后运行以下命令：

   ```
   $ unzip swift-sample-UI.zip
   ```

1. 成功解压缩程序包后，您可以通过运行以下命令找到工作目录树结构：

   ```
   $ tree .
   ```

   如果 XCTest UI 程序包有效，您应在 .zip 测试程序包中找到类似于示例中的 `swift-sampleUITests-Runner.app` 的单个 `.app` 目录。

   ```
   .
   `--swift-sample-UI.zip--(directory)
       `-- swift-sampleUITests-Runner.app (directory)
               |-- Info.plist
               |-- Plugins (directory)
               |       `swift-sampleUITests.xctest (directory)
              |            |-- Info.plist
              |            `-- (any other files)
               `-- (any other files)
       `-- (any other files)
   ```

   有关更多信息，请参阅 [将 iOS XCTest 用户界面与 Device Farm 集成](test-types-ios-xctest-ui.md)。

## XCTEST\$1UI\$1TEST\$1PACKAGE\$1MULTIPLE\$1IPA\$1DIRS
<a name="XCTEST_UI_TEST_PACKAGE_MULTIPLE_IPA_DIRS"></a>

如果您看到以下消息，请执行以下步骤来修复此问题。

`We found multiple .ipa directories inside your test package. Please unzip your test package, verify that only a single .ipa directory is present inside the package, then try again.`

1. 将您的测试程序包复制到工作目录，然后运行以下命令：

   ```
   $ unzip swift-sample-UI.zip
   ```

1. 成功解压缩程序包后，您可以通过运行以下命令找到工作目录树结构：

   ```
   $ tree .
   ```

   如果 XCTest UI 程序包有效，您应在 .zip 测试程序包中找到类似于示例中的 `sampleUITests.ipa` 的单个 `.ipa` 目录。

   ```
   .
   `--swift-sample-UI.zip--(directory)
       `-- sampleUITests.ipa (directory)
               `-- Payload (directory)
                   `-- swift-sampleUITests-Runner.app (directory)
       `-- (any other files)
   ```

   有关更多信息，请参阅 [将 iOS XCTest 用户界面与 Device Farm 集成](test-types-ios-xctest-ui.md)。

## XCTEST\$1UI\$1TEST\$1PACKAGE\$1BOTH\$1APP\$1AND\$1IPA\$1DIR\$1PRESENT
<a name="XCTEST_UI_TEST_PACKAGE_BOTH_APP_AND_IPA_DIR_PRESENT"></a>

如果您看到以下消息，请执行以下步骤来修复此问题。

`We found both .app and .ipa files inside your test package. Please unzip your test package, verify that only a single .app or .ipa file is present inside the package, then try again.`

1. 将您的测试程序包复制到工作目录，然后运行以下命令：

   ```
   $ unzip swift-sample-UI.zip
   ```

1. 成功解压缩程序包后，您可以通过运行以下命令找到工作目录树结构：

   ```
   $ tree .
   ```

   如果 XCTest UI 程序包有效，您应在 .zip 测试程序包中找到类似于示例中的 `sampleUITests.ipa` 的 `.ipa` 目录或类似于 `swift-sampleUITests-Runner.app` 的 `.app` 目录。您可以参考 [将 iOS XCTest 用户界面与 Device Farm 集成](test-types-ios-xctest-ui.md) 相关文档中的有效 XCTEST\$1UI 测试程序包示例。

   ```
   .
   `--swift-sample-UI.zip--(directory)
       `-- sampleUITests.ipa (directory)
               `-- Payload (directory)
                   `-- swift-sampleUITests-Runner.app (directory)
      `-- (any other files)
   ```

    或 

   ```
   .
   `--swift-sample-UI.zip--(directory)
       `-- swift-sampleUITests-Runner.app (directory)
               |-- Info.plist
               |-- Plugins (directory)
               `-- (any other files)
      `-- (any other files)
   ```

   有关更多信息，请参阅 [将 iOS XCTest 用户界面与 Device Farm 集成](test-types-ios-xctest-ui.md)。

## XCTEST\$1UI\$1TEST\$1PACKAGE\$1PAYLOAD\$1DIR\$1PRESENT\$1IN\$1ZIP
<a name="XCTEST_UI_TEST_PACKAGE_PAYLOAD_DIR_PRESENT_IN_ZIP"></a>

如果您看到以下消息，请执行以下步骤来修复此问题。

`We found a Payload directory inside your .zip test package. Please unzip your test package, ensure that a Payload directory is not present in the package, then try again.`

1. 将您的测试程序包复制到工作目录，然后运行以下命令：

   ```
   $ unzip swift-sample-UI.zip
   ```

1. 成功解压缩程序包后，您可以通过运行以下命令找到工作目录树结构：

   ```
   $ tree .
   ```

   如果 XCTest UI 程序包有效，您不应在测试程序包中找到 Payload 目录。

   ```
   .
   `--swift-sample-UI.zip--(directory)
       `-- swift-sampleUITests-Runner.app (directory)
               |-- Info.plist
               |-- Plugins (directory)
               `-- (any other files)
      `-- Payload (directory) [This directory should not be present]
               |-- (any other files)
      `-- (any other files)
   ```

   有关更多信息，请参阅 [将 iOS XCTest 用户界面与 Device Farm 集成](test-types-ios-xctest-ui.md)。