test/automated-pytest-suite
Yang Liu 33756ac899 Initial submission for starlingx pytest framework.
Include:
- util modules. such as table_parser, ssh/localhost clients, cli module,
exception, logger, etc. Util modules are mostly used by keywords.
- keywords modules. These are helper functions that are used directly by
test functions.
- platform (with platform or platform_sanity marker) and stx-openstack
(with sanity, sx_sanity, cpe_sanity, or storage_sanity marker) sanity
testcases
- pytest config conftest, and test fixture modules
- test config file template/example

Required packages:
- python3.4 or python3.5
- pytest >=3.10,<4.0
- pexpect
- requests
- pyyaml
- selenium (firefox, ffmpeg, pyvirtualdisplay, Xvfb or Xephyr or Xvnc)

Limitations:
- Anything that requires copying from Test File Server will not work until
a public share is configured to shared test files. Tests skipped for now.

Co-Authored-By: Maria Yousaf <maria.yousaf@windriver.com>
Co-Authored-By: Marvin Huang <marvin.huang@windriver.com>
Co-Authored-By: Yosief Gebremariam <yosief.gebremariam@windriver.com>
Co-Authored-By: Paul Warner <paul.warner@windriver.com>
Co-Authored-By: Xueguang Ma <Xueguang.Ma@windriver.com>
Co-Authored-By: Charles Chen <charles.chen@windriver.com>
Co-Authored-By: Daniel Graziano <Daniel.Graziano@windriver.com>
Co-Authored-By: Jordan Li <jordan.li@windriver.com>
Co-Authored-By: Nimalini Rasa <nimalini.rasa@windriver.com>
Co-Authored-By: Senthil Mukundakumar <senthil.mukundakumar@windriver.com>
Co-Authored-By: Anuejyan Manokeran <anujeyan.manokeran@windriver.com>
Co-Authored-By: Peng Peng <peng.peng@windriver.com>
Co-Authored-By: Chris Winnicki <chris.winnicki@windriver.com>
Co-Authored-By: Joe Vimar <Joe.Vimar@windriver.com>
Co-Authored-By: Alex Kozyrev <alex.kozyrev@windriver.com>
Co-Authored-By: Jack Ding <jack.ding@windriver.com>
Co-Authored-By: Ming Lei <ming.lei@windriver.com>
Co-Authored-By: Ankit Jain <ankit.jain@windriver.com>
Co-Authored-By: Eric Barrett <eric.barrett@windriver.com>
Co-Authored-By: William Jia <william.jia@windriver.com>
Co-Authored-By: Joseph Richard <Joseph.Richard@windriver.com>
Co-Authored-By: Aldo Mcfarlane <aldo.mcfarlane@windriver.com>

Story: 2005892
Task: 33750
Signed-off-by: Yang Liu <yang.liu@windriver.com>

Change-Id: I7a88a47e09733d39f024144530f5abb9aee8cad2
2019-07-15 15:30:00 -04:00
..
consts Initial submission for starlingx pytest framework. 2019-07-15 15:30:00 -04:00
keywords Initial submission for starlingx pytest framework. 2019-07-15 15:30:00 -04:00
testcases Initial submission for starlingx pytest framework. 2019-07-15 15:30:00 -04:00
testfixtures Initial submission for starlingx pytest framework. 2019-07-15 15:30:00 -04:00
utils Initial submission for starlingx pytest framework. 2019-07-15 15:30:00 -04:00
README.rst Initial submission for starlingx pytest framework. 2019-07-15 15:30:00 -04:00
__init__.py Initial submission for starlingx pytest framework. 2019-07-15 15:30:00 -04:00
conftest.py Initial submission for starlingx pytest framework. 2019-07-15 15:30:00 -04:00
pytest.ini Initial submission for starlingx pytest framework. 2019-07-15 15:30:00 -04:00
requirements.txt Initial submission for starlingx pytest framework. 2019-07-15 15:30:00 -04:00
setups.py Initial submission for starlingx pytest framework. 2019-07-15 15:30:00 -04:00
stx-test_template.conf Initial submission for starlingx pytest framework. 2019-07-15 15:30:00 -04:00

README.rst

StarlingX Integration Test Framework

The project contains integration test cases that can be executed on an installed and configured StarlingX system.

Supported test cases:

  • CLI tests over SSH connection to StarlingX system via OAM floating IP
  • Platform RestAPI test cases via external endpoints
  • Horizon test cases

Packages Required

  • python >='3.4.3,<3.7'
  • pytest>='3.1.0,<4.0'
  • pexpect
  • pyyaml
  • requests (used by RestAPI test cases only)
  • selenium (used by Horizon test cases only)
  • Firefox (used by Horizon test cases only)
  • pyvirtualdisplay (used by Horizon test cases only)
  • ffmpeg (used by Horizon test cases only)
  • Xvfb or Xephyr or Xvnc (used by pyvirtualdisplay for Horizon test cases only)

Setup Test Tool

This is a off-box test tool that needs to be set up once on a Linux server that can reach the StarlingX system under test (such as SSH to STX system, send/receive RestAPI requests, open Horizon page).

  • Install above packages
  • Clone stx-test repo
  • Add absolute path for automated-pytest-suite to PYTHONPATH environment variable

Execute Test Cases

Precondition: STX system under test should be installed and configured.

  • Customized config can be provided via --testcase-config <config_file>.
    Config template can be found at ${project_root}/stx-test_template.conf.
  • Test cases can be selected by specifying via -m <markers>
  • If stx-openstack is not deployed, platform specific marker should be specified,
    e.g., -m "platform_sanity or platform"
  • Automation logs will be created at ${HOME}/AUTOMATION_LOGS directory by default.
    Log directory can also be specified with --resultlog=${LOG_DIR} commandline option
  • Examples:
export project_root=<automated-pytest-suite dir>

# Include $project_root to PYTHONPATH if not already done
export PYTHONPATH=${PYTHONPATH}:${project_root}

cd $project_root

# Example 1: Run all platform_sanity test cases under testcases/
pytest -m platform_sanity --testcase-config=~/my_config.conf testcases/

# Example 2: Run platform_sanity or sanity (requires stx-openstack) test cases,
# on a StarlingX virtual box system that is already saved in consts/lab.py
# and save automation logs to /tmp/AUTOMATION_LOGS
pytest --resultlog=/tmp/ -m sanity --lab=vbox --natbox=localhost testcases/

# Example 3: List (not execute) the test cases with "migrate" in the name
pytest --collect-only -k "migrate" --lab=<stx_oam_fip> testcases/

Contribute

  • In order to contribute, python3.4 is required to avoid producing code that is incompatible with python3.4.