Create a Test Package

  1. Set up a Python virtual environment with virtualenv to generate your requirements.txt file so that only required packages are included and global and system packages are omitted.

    1. Install virtualenv through pip.

    2. Setup a virtualenv. For example:

    python virtualenv venv cd venv source bin/activate
  2. Install the Appium Python client library in the virtual environment.

pip install Appium-Python-Client
  1. Install pytest in the virtual environment. Pytest will be used as the test runner. Your tests do not need to be written using the Pytest framework.
pip install pytest
  1. Install any other dependencies required by your tests.

  2. Check that your existing tests are discoverable in the tests folder with Pytest.

pytest --collect-only tests/
  1. Remove any files and folders that are not needed for testing. Remove Python cache files such as:
  • pycache
  • *.pyc
  • *.pyo
  • *~
  1. Generate the requirements.txt file in the virtual environment.
pip freeze > requirements.txt
  1. Zip up the tests folder and requirements.txt file.
zip -r test_package.zip tests/ requirements.txt