Skip to content

fromiva/DemoPyTest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demo project to explore pytest and pyVmomi libraries

Project for functionality exploration of pythest testing framework and pyVmomi library (the VMware vSphere API Python Bindings) for VMware ESXi automated testing.

Software requirements

The following software needs to be preinstalled to run tests correctly

  • Python 3.8+ with pip package manager (on some *nix systems it can be entitled as the python3 and pip3 accordingly)
  • Python IDE or Terminal

Components requirements

The following components net to be specified to run tests correctly

  • VMware ESXi host connection settings in config.ini file

    [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 .ovf descriptor file need to be specified in the test case. (for technical reason OVF template don't provided with this repository; use ovf folder 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) or open-vm-tools-desktop (for Ubuntu Desktop)

  • VM credentials to remote login in config.ini file

    [VM]
    username=user
    password=password
  • VM username also need to be specified in the test case to derive the remote file locations

Steps to run tests (for terminal)

  1. Set the root project directory as a current working directory (use your correct path)

    cd /path/to/project
  2. Initialize the Python virtual environment (for the first time only)

    python -m venv venv
  3. Activate the Python virtual environment

    source venv/bin/activate
  4. Install all the project-specific dependencies (for the first run only)

    pip install -r requirements.txt

    It installs the following dependencies:

    • pytest version 8.2.2 (current latest)
    • requests version 2.32.3 (current latest)
    • pyvmomi version 8.0.3.0.0 (the library version should correspond your VMware ESXi version; for more information see the Versioning section in the pyvmomi repository README; list of available versions see at PyPi), to change version please edit requirements.txt file or use the following command:
      # pip install --upgrade pyvmomi==<proper version>, for example
      pip install --upgrade pyvmomi==8.0.2.0.1
  5. Run tests

    pytest
  6. Deactivate the Python virtual environment (optional)

    deactivate

Links

About

Demo PyTest and pyVmomi test case

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages