Project for functionality exploration of pythest testing framework
and pyVmomi library (the VMware vSphere API Python Bindings)
for VMware ESXi automated testing.
The following software needs to be preinstalled to run tests correctly
- Python 3.8+ with
pippackage manager (on some *nix systems it can be entitled as thepython3andpip3accordingly) - Python IDE or Terminal
The following components net to be specified to run tests correctly
-
VMware ESXi host connection settings in
config.inifile[ESXi] ; Host address host=192.168.1.94 ; Host credentials to remote login user=root pwd=password ; Disable SSL cert verification if you use default or self-issued one (optional) disableSslCertValidation=True
-
OVF template for the new virtual machine deployment. Path to
.ovfdescriptor file need to be specified in the test case. (for technical reason OVF template don't provided with this repository; useovffolder to provide one) -
VMware Guest Tools need to be preinstalled in OVF template to perform filesystem operations. For example for Ubuntu Linux you need to install packages
open-vm-tools(for Ubuntu Server) oropen-vm-tools-desktop(for Ubuntu Desktop) -
VM credentials to remote login in
config.inifile[VM] username=user password=password
-
VM username also need to be specified in the test case to derive the remote file locations
-
Set the root project directory as a current working directory (use your correct path)
cd /path/to/project -
Initialize the Python virtual environment (for the first time only)
python -m venv venv
-
Activate the Python virtual environment
source venv/bin/activate -
Install all the project-specific dependencies (for the first run only)
pip install -r requirements.txt
It installs the following dependencies:
pytestversion 8.2.2 (current latest)requestsversion 2.32.3 (current latest)pyvmomiversion 8.0.3.0.0 (the library version should correspond your VMware ESXi version; for more information see the Versioning section in thepyvmomirepository README; list of available versions see at PyPi), to change version please editrequirements.txtfile or use the following command:# pip install --upgrade pyvmomi==<proper version>, for example pip install --upgrade pyvmomi==8.0.2.0.1
-
Run tests
pytest
-
Deactivate the Python virtual environment (optional)
deactivate