From: Fiete Ostkamp Date: Sun, 2 Mar 2025 15:45:25 +0000 (+0100) Subject: Update robotframework in testsuite to 3.2.2 X-Git-Tag: 1.14.1~10 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F30%2F140330%2F6;p=testsuite.git Update robotframework in testsuite to 3.2.2 - declare robotframework-onap in requirements.txt and pin it's version - add missing robotframework-jsonlibrary that is used in the ves.robot tests - clean up deprecated syntax in Dockerfile - improve the README formatting and add further instructions to setup the project and run tests - add an initial robot_properties.py file that may contain variable declarations that are required to run the tests locally Issue-ID: INT-2295 Change-Id: Ia913c610a6418643967ba1fd2791ae42038ac85e Signed-off-by: Fiete Ostkamp --- diff --git a/.gitignore b/.gitignore index f8a9ed4e..e0256c86 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ .project .tox/ /docker/requirements.txt +.venv diff --git a/README.md b/README.md index ed3c4a37..30cc6757 100644 --- a/README.md +++ b/README.md @@ -1,84 +1,145 @@ # Getting Started + +This repository contains the end-to-end testsuite of ONAP. It is based on the [Robot Framework](https://robotframework.org/#resources), 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](https://gerrit.onap.org/r/admin/repos/testsuite/python-testing-utils). + ## Prerequisites + This guide assumes you have run git clone on https://gerrit.onap.org/r/testsuite.git For more info please see the [Development Guide](https://wiki.onap.org/display/DW/Robot+Framework+Development+Guide) ## Development Environment Setup -### Python Installation -You should install 2.7.12: [https://www.python.org/downloads/release/python-2712](https://www.python.org/downloads/release/python-2712) +### Create a virtual environment -### Pip Install -Install pip with the get-pip.py file from [https://bootstrap.pypa.io/get-pip.py](https://bootstrap.pypa.io/get-pip.py) -once downloaded run +```sh +python3 -m venv .venv +``` +```sh +source .venv/bin/activate ``` -python get-pip.py + +### Install dependencies + +Make sure that you have activated the `venv` that you have created in the previous step. Then run + +```sh +pip install -r requirements.txt ``` -let it install. -From the desktop, 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. +### Proxy setup +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. -### Robot Install -Reopen Command prompt window, and run below code to install robot. +## Project Setup -``` -pip install robotframework +Note: You do not need to run these commands every time, only on a library update or initial checkout. + +```sh +./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. -### IDE Install -Most further documents will use the RED environment for Robot. -[https://github.com/nokia/RED/releases/download/0.7.0/RED\_0.7.0.20160914115048-win32.win32.x86_64.zip](https://github.com/nokia/RED/releases/download/0.7.0/RED\_0.7.0.20160914115048-win32.win32.x86_64.zip) +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. -Once you install that IDE you probably will want to have a python editor to edit python files better. -Go to Help > Eclipse Marketplace and search for PyDev and click install on PyDev for Eclipse 5.2.0 +## Executing ETE Testcases -Once you install that IDE you will need EGit to check in git code. -Go to Help > Eclipse Marketplace and search for Egit git team provider and click install on EGit Git Team Provider 4.5.0 +### Overview +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 in `robot/testsuites` to execute. + +### Invoke directly + +```sh +$ 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 +``` -Once you install that IDE you will probably want a json editor to edit json better. -Go to Help > Eclipse Marketplace and search for Json Tools and click install on Json Tools 1.1.0 +#### Filter by tags -### Project Setup -Note: You do not need to run these commands every time, only on a library update or initial checkout. +You can provide a `--include` or `-i` argument to filter the tests by tag. +Tags are declared in the `.robot` files. For instance -``` -./setup.sh +```python +# excerpt from robot/testsuites/health-check.robot +*** Test Cases *** +Basic A&AI Health Check + [Tags] health core health-aai + Run A&AI Health Check ``` -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. +```sh +$ 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(': 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 +``` -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. +#### Run/Debug inside Kubernetes cluster +```sh +$ kubectl -n onap run tmp-testsuite -it --rm --restart=Nev +er --image=nexus3.onap.org:10001/onap/testsuite:latest -- /bin/bash +root@tmp-testsuite:/# +``` -## Executing ETE Testcases -### Overview -Two scripts have been provided in the root of the ete-testsuite project to enable test execution +```sh +$ 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 +``` -* 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 in robot/testsuites to execute. - #### runTags.sh -For further information on using Robot [Tags], see [http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#configuring-execution] and [http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#simple-patterns] + +For further information on using Robot [Tags], see [Configuring Execution](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#configuring-execution) and [Simple Patterns](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#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 +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. -``` +```sh runTags.sh -i health -i ete -e garbage ``` diff --git a/docker/Dockerfile b/docker/Dockerfile index 3ad7181a..ce513480 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,18 +1,14 @@ -FROM ubuntu:20.04 as base +FROM ubuntu:20.04 AS base ## Be careful of Windows newlines -MAINTAINER "ONAP" LABEL name="Docker image for the ONAP Robot Testing Framework" LABEL usage="docker run -e ROBOT_TEST= -ti onapete" ENV BUILDTIME=true -ENV DEBIAN_FRONTEND noninteractive +ENV DEBIAN_FRONTEND=noninteractive ARG KUBERNETES_VERSION="v1.23.8" ARG HELM_VERSION="v3.8.2" -ARG PYTHON_UTILS_REPO=git.onap.org/testsuite/python-testing-utils.git -ARG PYTHON_UTILS_TAG=master - ARG DEMO_REPO=git.onap.org/demo ARG DEMO_TAG=master @@ -55,7 +51,6 @@ COPY requirements.txt requirements.txt RUN mkdir -p /var/opt/ONAP && \ pip3 install --no-cache-dir -r requirements.txt setuptools wheel virtualenv && \ - pip3 install --no-cache-dir git+https://$PYTHON_UTILS_REPO@$PYTHON_UTILS_TAG#egg=robotframework-onap\&subdirectory=robotframework-onap && \ git clone --depth 1 https://$DEMO_REPO -b $DEMO_TAG /var/opt/ONAP/demo && \ chmod +x /usr/local/bin/kubectl && \ chmod 700 get_helm.sh && \ diff --git a/requirements.txt b/requirements.txt index ebe0f12d..9129ced2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,15 +1,15 @@ -robotframework==3.1.2 +--extra-index-url https://nexus3.onap.org/repository/PyPi.staging/simple +robotframework==3.2.2 pyrsistent==0.16.1 selenium -robotframework-seleniumlibrary +robotframework-seleniumlibrary==5.1.0 robotframework-archivelibrary robotframework-sshlibrary robotframework-httplibrary robotframework-ftplibrary +robotframework-jsonlibrary requests>=2.20.0 -robotframework-selenium2library robotframework-databaselibrary -robotframework-extendedselenium2library robotframework-requests==0.9.3 deepdiff dnspython @@ -17,3 +17,4 @@ pyyaml>=4.2b1 json5 pytz urllib3<2 +robotframework-onap==11.0.0.dev19 diff --git a/robot_properties.py b/robot_properties.py new file mode 100644 index 00000000..991a0391 --- /dev/null +++ b/robot_properties.py @@ -0,0 +1,15 @@ +# The robot tests require a global variables file that +# contains environment specific values like service names and credentials. +# You'll find the real values in the OOM robot chart. +# When executed locally, these values are different and need to be adjusted +# to the environment they are running in. +GLOBAL_INJECTED_SO_BPMN_IP_ADDR = '127.0.0.1' +GLOBAL_AAI_SERVER_PROTOCOL = 'http' +GLOBAL_INJECTED_AAI_IP_ADDR = 'aai.onap' +GLOBAL_AAI_SERVER_PORT = '80' +GLOBAL_AAI_AUTHENTICATION = ('AAI','AAI') +GLOBAL_SDC_SERVER_PROTOCOL = 'http' +GLOBAL_DCAE_HVVES_SERVER_NAME= 'dcae-ves-collector.onap' +GLOBAL_DCAE_HVVES_SERVER_PORT= '8080' +GLOBAL_KAFKA_BOOTSTRAP_SERVICE= 'onap-strimzi-kafka-bootstrap.onap' +GLOBAL_KAFKA_USER= 'strimzi-kafka-admin' diff --git a/version.properties b/version.properties index aab13add..1092bd5f 100644 --- a/version.properties +++ b/version.properties @@ -4,7 +4,7 @@ major=1 minor=14 -patch=0 +patch=1 base_version=${major}.${minor}.${patch}