Create a Test Package
-
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.
Install virtualenv through pip.
Setup a virtualenv. For example:
python virtualenv venv cd venv source bin/activate -
Install the Appium Python client library in the virtual environment.
pip install Appium-Python-Client
- 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
-
Install any other dependencies required by your tests.
-
Check that your existing tests are discoverable in the tests folder with Pytest.
pytest --collect-only tests/
- Remove any files and folders that are not needed for testing. Remove Python cache files such as:
- pycache
- *.pyc
- *.pyo
- *~
- Generate the requirements.txt file in the virtual environment.
pip freeze > requirements.txt
- Zip up the tests folder and requirements.txt file.
zip -r test_package.zip tests/ requirements.txt