AWS 裝置伺服器陣列中 Appium Python 網路應用程式測試的疑難排解 - AWS Device Farm

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

AWS 裝置伺服器陣列中 Appium Python 網路應用程式測試的疑難排解

下列主題會列出在上傳 Appium Python Web 應用程式測試期間出現的錯誤訊息,並建議解決每個錯誤的解決方法。

APPIUM_WEB_PYTHON_TEST_PACKAGE_UNZIP_FAILED

如果您看到下列訊息,請依照以下步驟修復問題。

警告

無法開啟您的 Appium ZIP 檔。請確認檔案是否有效,然後再試一次。

請確認您可以正確解壓縮測試套件。在下列範例中,套件的名稱是 test_bundle.zip

  1. 將您的測試套件複製到工作目錄,然後執行下列命令:

    $ unzip test_bundle.zip
  2. 成功解壓縮套件後,您可以透過執行下列命令找到樹狀結構的工作目錄:

    $ tree .

    有效的 Appium Python 套件應產生輸出如下:

    . |-- requirements.txt |-- test_bundle.zip |-- tests (directory) | `-- test_unittest.py `-- wheelhouse (directory) |-- Appium_Python_Client-0.20-cp27-none-any.whl |-- py-1.4.31-py2.py3-none-any.whl |-- pytest-2.9.0-py2.py3-none-any.whl |-- selenium-2.52.0-cp27-none-any.whl `-- wheel-0.26.0-py2.py3-none-any.whl

    如需詳細資訊,請參閱使用 Appium 和 AWS Device Farm

APPIUM_WEB_PYTHON_TEST_PACKAGE_DEPENDENCY_WHEEL_MISSING

如果您看到下列訊息,請依照以下步驟修復問題。

警告

在 wheelhouse 目錄樹狀結構中找不到相依性 wheel 檔案。請解壓縮您的測試套件,開啟 wheelhouse 目錄,確認目錄中至少有一個 wheel 檔案,然後再試一次。

請確認您可以正確解壓縮測試套件。在下列範例中,套件的名稱是 test_bundle.zip

  1. 將您的測試套件複製到工作目錄,然後執行下列命令:

    $ unzip test_bundle.zip
  2. 成功解壓縮套件後,您可以透過執行下列命令找到樹狀結構的工作目錄:

    $ tree .

    如果 Appium Python 套件是有效的,您可以找到至少一個 .whl 檔案,類似於 wheelhouse 目錄中反白顯示的檔案。

    . |-- requirements.txt |-- test_bundle.zip |-- tests (directory) | `-- test_unittest.py `-- wheelhouse (directory) |-- Appium_Python_Client-0.20-cp27-none-any.whl |-- py-1.4.31-py2.py3-none-any.whl |-- pytest-2.9.0-py2.py3-none-any.whl |-- selenium-2.52.0-cp27-none-any.whl `-- wheel-0.26.0-py2.py3-none-any.whl

    如需詳細資訊,請參閱使用 Appium 和 AWS Device Farm

APPIUM_WEB_PYTHON_TEST_PACKAGE_INVALID_PLATFORM

如果您看到下列訊息,請依照以下步驟修復問題。

警告

至少有一個 wheel 檔案指定了我們不支援的平台。請解壓縮您的測試套件後開啟 wheelhouse 目錄,確認 wheel 檔案的名稱以 -any.whl 或 -linux_x86_64.whl 結尾,然後再試一次。

請確認您可以正確解壓縮測試套件。在下列範例中,套件的名稱是 test_bundle.zip

  1. 將您的測試套件複製到工作目錄,然後執行下列命令:

    $ unzip test_bundle.zip
  2. 成功解壓縮套件後,您可以透過執行下列命令找到樹狀結構的工作目錄:

    $ tree .

    如果 Appium Python 套件是有效的,您可以找到至少一個 .whl 檔案,類似於 wheelhouse 目錄中反白顯示的檔案。檔案的名稱可能不同,但應以 -any.whl-linux_x86_64.whl 結尾 (用於指定平台)。不支援 windows 等任何其他平台。

    . |-- requirements.txt |-- test_bundle.zip |-- tests (directory) | `-- test_unittest.py `-- wheelhouse (directory) |-- Appium_Python_Client-0.20-cp27-none-any.whl |-- py-1.4.31-py2.py3-none-any.whl |-- pytest-2.9.0-py2.py3-none-any.whl |-- selenium-2.52.0-cp27-none-any.whl `-- wheel-0.26.0-py2.py3-none-any.whl

    如需詳細資訊,請參閱使用 Appium 和 AWS Device Farm

APPIUM_WEB_PYTHON_TEST_PACKAGE_TEST_DIR_MISSING

如果您看到下列訊息,請依照以下步驟修復問題。

警告

在測試套件找不到測試目錄。請解壓縮您的測試套件,確認測試目錄位於套件中,然後再試一次。

請確認您可以正確解壓縮測試套件。在下列範例中,套件的名稱是 test_bundle.zip

  1. 將您的測試套件複製到工作目錄,然後執行下列命令:

    $ unzip test_bundle.zip
  2. 成功解壓縮套件後,您可以透過執行下列命令找到樹狀結構的工作目錄:

    $ tree .

    如果 Appium Python 套件是有效的,您可以在工作目錄中找到測試目錄。

    . |-- requirements.txt |-- test_bundle.zip |-- tests (directory) | `-- test_unittest.py `-- wheelhouse (directory) |-- Appium_Python_Client-0.20-cp27-none-any.whl |-- py-1.4.31-py2.py3-none-any.whl |-- pytest-2.9.0-py2.py3-none-any.whl |-- selenium-2.52.0-cp27-none-any.whl `-- wheel-0.26.0-py2.py3-none-any.whl

    如需詳細資訊,請參閱使用 Appium 和 AWS Device Farm

APPIUM_WEB_PYTHON_TEST_PACKAGE_INVALID_TEST_FILE_NAME

如果您看到下列訊息,請依照以下步驟修復問題。

警告

在測試目錄樹狀結構中找不到有效的測試檔案。請解壓縮您的測試套件,開啟測試目錄,確認至少一個檔案的名稱以關鍵字「test」開頭或結尾,然後再試一次。

請確認您可以正確解壓縮測試套件。在下列範例中,套件的名稱是 test_bundle.zip

  1. 將您的測試套件複製到工作目錄,然後執行下列命令:

    $ unzip test_bundle.zip
  2. 成功解壓縮套件後,您可以透過執行下列命令找到樹狀結構的工作目錄:

    $ tree .

    如果 Appium Python 套件是有效的,您可以在工作目錄中找到測試目錄。檔案的名稱可能不同,但應以 test_ 開頭,或以 _test.py 結尾。

    . |-- requirements.txt |-- test_bundle.zip |-- tests (directory) | `-- test_unittest.py `-- wheelhouse (directory) |-- Appium_Python_Client-0.20-cp27-none-any.whl |-- py-1.4.31-py2.py3-none-any.whl |-- pytest-2.9.0-py2.py3-none-any.whl |-- selenium-2.52.0-cp27-none-any.whl `-- wheel-0.26.0-py2.py3-none-any.whl

    如需詳細資訊,請參閱使用 Appium 和 AWS Device Farm

APPIUM_WEB_PYTHON_TEST_PACKAGE_REQUIREMENTS_TXT_FILE_MISSING

如果您看到下列訊息,請依照以下步驟修復問題。

警告

在測試套件找不到 requirements.txt 檔案。請解壓縮您的測試套件,確認 requirements.txt 檔案位於套件中,然後再試一次。

請確認您可以正確解壓縮測試套件。在下列範例中,套件的名稱是 test_bundle.zip

  1. 將您的測試套件複製到工作目錄,然後執行下列命令:

    $ unzip test_bundle.zip
  2. 成功解壓縮套件後,您可以透過執行下列命令找到樹狀結構的工作目錄:

    $ tree .

    如果 Appium Python 套件是有效的,您可以在工作目錄中找到 requirements.txt 檔案。

    . |-- requirements.txt |-- test_bundle.zip |-- tests (directory) | `-- test_unittest.py `-- wheelhouse (directory) |-- Appium_Python_Client-0.20-cp27-none-any.whl |-- py-1.4.31-py2.py3-none-any.whl |-- pytest-2.9.0-py2.py3-none-any.whl |-- selenium-2.52.0-cp27-none-any.whl `-- wheel-0.26.0-py2.py3-none-any.whl

    如需詳細資訊,請參閱使用 Appium 和 AWS Device Farm

APPIUM_WEB_PYTHON_TEST_PACKAGE_INVALID_PYTEST_VERSION

如果您看到下列訊息,請依照以下步驟修復問題。

警告

pytest 版本低於支援的最低版本 2.8.0。請變更 requirements.txt 中的 pytest 版本,然後再試一次。

請確認您可以正確解壓縮測試套件。在下列範例中,套件的名稱是 test_bundle.zip

  1. 將您的測試套件複製到工作目錄,然後執行下列命令:

    $ unzip test_bundle.zip
  2. 成功解壓縮套件後,您可以透過執行下列命令找到樹狀結構的工作目錄:

    $ tree .

    您應可在工作目錄中找到 requirement.txt 檔案。

    . |-- requirements.txt |-- test_bundle.zip |-- tests (directory) | `--test_unittest.py `-- wheelhouse (directory) |-- Appium_Python_Client-0.20-cp27-none-any.whl |-- py-1.4.31-py2.py3-none-any.whl |-- pytest-2.9.0-py2.py3-none-any.whl |-- selenium-2.52.0-cp27-none-any.whl `-- wheel-0.26.0-py2.py3-none-any.whl
  3. 若要取得 pytest 版本,您可以執行下列命令:

    $ grep "pytest" requirements.txt

    輸出應顯示如下:

    pytest==2.9.0

    系統會顯示 pytest 版本,在此範例中為 2.9.0。如果 Appium Python 套件是有效的,則 pytest 版本應高於或等於 2.8.0。

    如需詳細資訊,請參閱使用 Appium 和 AWS Device Farm

APPIUM_WEB_PYTHON_TEST_PACKAGE_INSTALL_DEPENDENCY_WHEELS_FAILED

如果您看到下列訊息,請依照以下步驟修復問題。

警告

無法安裝相依性 wheel。請解壓縮您的測試套件,開啟 requirements.txt 檔案和 wheelhouse 目錄,確認 requirements.txt 檔案中指定的相依性 wheel 完全符合 wheelhouse 目錄中的相依性 wheel,然後再試一次。

我們強烈建議您設定 Python virtualenv 來封裝測試。以下是使用 Python virtualenv 建立虛擬環境然後啟用的範例流程:

$ virtualenv workspace $ cd workspace $ source bin/activate

請確認您可以正確解壓縮測試套件。在下列範例中,套件的名稱是 test_bundle.zip

  1. 將您的測試套件複製到工作目錄,然後執行下列命令:

    $ unzip test_bundle.zip
  2. 若要測試安裝 wheel 檔案,您可以執行下列命令:

    $ pip install --use-wheel --no-index --find-links=./wheelhouse --requirement=./requirements.txt

    有效的 Appium Python 套件應產生輸出如下:

    Ignoring indexes: https://pypi.python.org/simple Collecting Appium-Python-Client==0.20 (from -r ./requirements.txt (line 1)) Collecting py==1.4.31 (from -r ./requirements.txt (line 2)) Collecting pytest==2.9.0 (from -r ./requirements.txt (line 3)) Collecting selenium==2.52.0 (from -r ./requirements.txt (line 4)) Collecting wheel==0.26.0 (from -r ./requirements.txt (line 5)) Installing collected packages: selenium, Appium-Python-Client, py, pytest, wheel Found existing installation: wheel 0.29.0 Uninstalling wheel-0.29.0: Successfully uninstalled wheel-0.29.0 Successfully installed Appium-Python-Client-0.20 py-1.4.31 pytest-2.9.0 selenium-2.52.0 wheel-0.26.0
  3. 若要停用虛擬環境,您可以執行下列命令:

    $ deactivate

    如需詳細資訊,請參閱使用 Appium 和 AWS Device Farm

APPIUM_WEB_PYTHON_TEST_PACKAGE_PYTEST_COLLECT_FAILED

如果您看到下列訊息,請依照以下步驟修復問題。

警告

無法在測試目錄中收集測試。請解壓縮您的測試套件,執行命令「py.test --collect-only <path to your tests directory>」,確認測試套件是否有效,並在命令未列印任何錯誤後再試一次。

我們強烈建議您設定 Python virtualenv 來封裝測試。以下是使用 Python virtualenv 建立虛擬環境然後啟用的範例流程:

$ virtualenv workspace $ cd workspace $ source bin/activate

請確認您可以正確解壓縮測試套件。在下列範例中,套件的名稱是 test_bundle.zip

  1. 將您的測試套件複製到工作目錄,然後執行下列命令:

    $ unzip test_bundle.zip
  2. 若要安裝 wheel 檔案,您可以執行下列命令:

    $ pip install --use-wheel --no-index --find-links=./wheelhouse --requirement=./requirements.txt
  3. 若要收集測試,您可以執行下列命令:

    $ py.test --collect-only tests

    有效的 Appium Python 套件應產生輸出如下:

    ==================== test session starts ==================== platform darwin -- Python 2.7.11, pytest-2.9.0, py-1.4.31, pluggy-0.3.1 rootdir: /Users/zhena/Desktop/Ios/tests, inifile: collected 1 items <Module 'test_unittest.py'> <UnitTestCase 'DeviceFarmAppiumWebTests'> <TestCaseFunction 'test_devicefarm'> ==================== no tests ran in 0.11 seconds ====================
  4. 若要停用虛擬環境,您可以執行下列命令:

    $ deactivate

    如需詳細資訊,請參閱 使用 Appium 和 AWS Device Farm