Update Robot Framework format - step 3
[integration/test.git] / docs / run-test-locally.rst
1 Run Integration Test Locally
2 ============================
3
4 Overview
5 ========
6 Sometimes you might want to run some CSIT integration tests on your VM
7 instead of the sandbox, this guide contains information about pre-requisites
8 that need to be installed.
9
10 Operating System
11 ----------------
12 To run the integration tests you will need a Linux-type OS, like Ubuntu or
13 CentOS. Setup can be done manually, or you can download a VM image with the
14 pre-installed OS.
15
16 Set up the integration test framework
17 -------------------------------------
18
19 Install Python
20 ______________
21
22 For Debian-based distributions
23
24 .. code-block::
25
26     sudo apt-get install python3
27     sudo apt-get install python3-pip
28
29 Install Robot Framework and Extended Requests Library
30 _____________________________________________________
31
32 .. note::
33   RobotFramework installation guide can be found `here <https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html>`_
34
35   Releng/Builder CI/CD installation options can be checked inside the `integration-install-robotframework.sh <https://github.com/opendaylight/releng-builder/blob/master/jjb/integration/integration-install-robotframework.sh>`_
36
37 .. code-block::
38
39   pip3 install robotframework
40   pip3 install robotframework-extendedrequestslibrary
41
42 Install Libraries needed for test suites
43 ________________________________________
44
45 .. code-block::
46
47   pip3 install alabaster Babel docutils imagesize Jinja2 lfdocs-conf
48
49 Setup SSH access
50 ________________
51 Add new user with name `jenkins` to the linux, setup home directory for this
52 user. Create and add pair of ssh keys. Put them to /home/jenkins/.ssh
53
54 .. note::
55   This is only applicable if you don't change a ${DEFAULT_USER} variable.
56
57 Test ssh connection:
58
59 .. code-block::
60
61   ssh jenkins@localhost -i /home/jenkins/.ssh/id-rsa
62
63 .. warning::
64   If *Robot* can not connect through SSH, but manually connection works ok - update paramiko library:
65
66   .. code-block::
67
68     pip3 install --upgrade robotframework-sshlibrary
69     pip3 install --upgrade paramiko
70
71 Run single integration test
72 ---------------------------
73
74 Start `Karaf` and install required features.
75
76 Run test:
77
78 .. code-block::
79
80   robot -L debug --variable KARAF_HOME:/home/user/workspace/netconf/karaf/target/assembly/bin --variable USER_HOME:/home/jenkins --variable DEFAULT_LINUX_PROMPT:\$ --variable ODL_SYSTEM_IP:127.0.0.1 --variable ODL_SYSTEM_1_IP:127.0.0.1 --variable RESTCONFPORT:8181 --variable IS_KARAF_APPL:True ./test.robot
81
82 Where
83   * *KARAF_HOME* - path to karaf directory
84   * *USER_HOME* - path to jenkins home directotry. Used by `Robot` to read id-rsa key for ssh connection. Can be set to any directory where .ssh folder with id-rsa key located
85   * *ODL_SYSTEM_IP* - IP of ODL restconf server.
86   * *ODL_SYSTEM_1_IP* (*ODL_SYSTEM_2_IP*, *ODL_SYSTEM_3_IP*) - IP`s of ODL cluster.
87   * *RESTCONFPORT* - Restconf server port. 8181 by default.
88
89 Current list of parameters used by jenkins job can be found at `integration-run-test.sh <https://github.com/opendaylight/releng-builder/blob/174e01d61a9472b0b25da8d05d7c56bfb5589809/jjb/integration/integration-run-test.sh#L40>`_ script.
90
91 Full list of variables available from the CSIT is configured under the `Variables.robot <https://github.com/opendaylight/integration-test/blob/master/csit/variables/Variables.robot>`_
92
93 .. note::
94   Every suite can have different options. Please check Jenkins configuration for the specific test.
95
96 Getting result
97 --------------
98
99 On test finish, test result will be in the same folder as `Robot` test file:
100   - report.html
101   - log.html
102   - output.xml