This repository contains the end-to-end testsuite of ONAP. It is based on the Robot Framework, which is a automation framework for test automation and robotic process automation.
This repo also makes use of a custom robot library - the robotframework-onap
package - that provides common functions that are written in 'plain' python. The repository that defines this library is the testsuite/python-testing-utils.
This guide assumes you have run git clone on https://gerrit.onap.org/r/testsuite.git
For more info please see the Development Guide
python3 -m venv .venv
source .venv/bin/activate
Make sure that you have activated the venv
that you have created in the previous step. Then run
pip install -r requirements.txt
Depending on your environment, it may be needed to configure proxy environment variables for your system.
For Windows, right click the Computer icon. Choose Properties from the context menu.
Click the Advanced system settings link. Click Environment Variables. In the section System Variables, click New.
In the New System Variable window, set the name as HTTPS_PROXY
then specify the value of the HTTPS_PROXY
environment variable as your proxy. Click OK. Close all remaining windows by clicking OK.
Note: You do not need to run these commands every time, only on a library update or initial checkout.
./setup.sh
Note that this script will download the chromedriver for the current OS. The default is linux64 which will download the appropriate chromedriver to /usr/local/bin so that it will be in the execution PATH.
Windows and Mac hosts will download into the current working directory. Windows and MAC users will need to ensure that the driver is in the execution PATH.
Two scripts have been provided in the root of the ete-testsuite project to enable test execution.
runTags.sh
- This shell uses Robot [Tags] to drive which tests are executed and is designed for automated testing.oneTest.sh
- This shell is designed for unit testing of individual .robot files. It accepts a single argument identifying the.robot
file inrobot/testsuites
to execute.
$ robot -V robot_properties.py robot/testsuites/health-check.robot
...
------------------------------------------------------------------------------
Mariadb Galera SO Connectivity Test | FAIL |
catalogdb: 'error: pod, type/name or --filename must be specified' does not contain 'current database:'
------------------------------------------------------------------------------
Health-Check :: Test that ONAP components are available via basic ... | FAIL |
66 critical tests, 1 passed, 65 failed
66 tests total, 1 passed, 65 failed
==============================================================================
Output: /home/ubuntu/development/onap/testsuite/output.xml
Log: /home/ubuntu/development/onap/testsuite/log.html
Report: /home/ubuntu/development/onap/testsuite/report.html
You can provide a --include
or -i
argument to filter the tests by tag.
Tags are declared in the .robot
files. For instance
# excerpt from robot/testsuites/health-check.robot
*** Test Cases ***
Basic A&AI Health Check
[Tags] health core health-aai
Run A&AI Health Check
$ robot -V robot_properties.py --include health-aai robot/testsuites/health-check.robot
...
Enhanced A&AI Health Check | FAIL |
ConnectionError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /aai/v19/service-design-and-creation/models/model/AAI-HealthCheck-Dummy (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9dd6aa06a0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
------------------------------------------------------------------------------
Health-Check :: Test that ONAP components are available via basic ... | FAIL |
2 critical tests, 0 passed, 2 failed
2 tests total, 0 passed, 2 failed
==============================================================================
Output: /home/ubuntu/development/onap/testsuite/output.xml
Log: /home/ubuntu/development/onap/testsuite/log.html
Report: /home/ubuntu/development/onap/testsuite/report.html
$ kubectl -n onap run tmp-testsuite -it --rm --restart=Nev
er --image=nexus3.onap.org:10001/onap/testsuite:latest -- /bin/bash
root@tmp-testsuite:/#
$ cd /var/opt/ONAP
$ root@tmp-testsuite:/var/opt/ONAP# ls -lh
total 48K
drwxr-xr-x 10 root root 4.0K Mar 3 08:03 demo
-rwxrwxrwx 1 root root 1.3K Mar 3 08:02 dnstraffic.sh
drwxr-xr-x 2 root root 4.0K Mar 3 08:03 html
drwxr-xr-x 1 root root 4.0K Mar 3 08:03 robot
-rwxrwxrwx 1 root root 2.9K Mar 3 08:02 runEteTag.sh
-rwxrwxrwx 1 root root 1016 Mar 3 08:02 runSoak.sh
-rwxrwxrwx 1 root root 2.5K Mar 3 08:02 runTags.sh
-rwxrwxrwx 1 root root 1.7K Mar 3 08:02 setup-hvves.sh
-rwxrwxrwx 1 root root 2.1K Mar 3 08:02 setup.sh
-rwxrwxrwx 1 root root 500 Mar 3 08:02 robot_properties.py
$ root@tmp-testsuite:/var/opt/ONAP# robot -V robot_properties.py --include health-aai robot/testsuites/health-check.robot
For further information on using Robot [Tags], see Configuring Execution and Simple Patterns
When executing tests via tags, all of the robot files in the project are scanned for tests cases with the specified tags.
There are 3 flavors of runTags.sh
- runTags.sh with no arguments. This defaults to the default tag or runTags.sh -i health
- runTags.sh with a single include tag. In this case the -i or --include may be omitted. So runTags.sh ete is the same as runTags.sh -i ete
- runTags.sh with multiple tags. In this case, tags must be accompanied by a -i/--include or -e/--exclude to properly identify the disposition of the tagged testcase.
runTags.sh -i health -i ete -e garbage