Merge "Fix error in REC-13"
[ta/cloudtaf.git] / README.rst
1 ..
2     Copyright 2019 Nokia
3
4     Licensed under the Apache License, Version 2.0 (the "License");
5     you may not use this file except in compliance with the License.
6     You may obtain a copy of the License at
7
8         http://www.apache.org/licenses/LICENSE-2.0
9
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15
16 Introduction
17 ------------
18
19 Test cases are executed within a virtual environment in order to have all
20 python package dependencies installed. This virtual environment creation is
21 managed by tox. Furthermore tox execution can be optionally wrapped with a
22 docker environment to provide required operating system packages and
23 configuration to pull dependencies.
24
25 Execution environment as simple diagram::
26
27   $ ./rfcli-docker <args> == [ docker [ tox [ virtualenv [ rfcli -> robotframework <args> ] ] ] ]
28
29 You can find here more details about how to execute in your machine here
30 (windows specific, but it contains tips also if you have linux):
31 :ref:`windowsinstructions`
32
33
34 Writing robot test cases
35 ------------------------
36 Please use the following tags mentioned here:
37 :ref:`taggingpolicy` and also consider our test case design guidelines:
38 :ref:`designguidelines`
39
40
41 Execution examples
42 ------------------
43
44 Docker + tox::
45
46   $ ./rfcli-docker -t path/to/target.ini -s smoke-tests testcases/
47
48 This is the most simple way to execute the cloudtaf2 tests. As docker is being
49 used the created python virtual environment as well as the resulting files will
50 be owned by the "root" and not the actual user. Additionally initial execution
51 will take some time to build the image.
52
53 You may also run directly *rfcli* environment with *tox*::
54
55   $ tox -e rfcli -- -t path/to/target.ini -s smoke-tests testcases
56
57
58 Execution examples - tox only
59 -----------------------------
60
61 This is more lightweight way to execute the tests but requires certain
62 operating system packages to be installed first. Please see the "Dockerfile"
63 for installed packages.
64
65 Tox only - more lightweight for those who know what they are doing::
66
67   $ tox -e rfcli -- -t path/to/target.ini -s smoke-tests testcases/
68
69 Virtual environment
70 -------------------
71
72 Python virtual environment is created with requirements.txt. All python
73 packages must be set to certain versions in order to execute tests the same way
74 with older builds as they have been initially executed.
75
76 To update the frozen versions to the latest, execute::
77
78   $ tox -e freeze
79
80 To add more packages, update the requirements-minimal.txt and execute::
81
82   $ tox -e freeze
83
84 You can add specific version requirements to the requirements-minimal.txt
85 to make sure that they are used in the generated frozen requirements.txt.
86
87 The recommendation is that the frozen requirements.txt file is not edited
88 directly but always via the requirements-minimal.txt changes and via this freeze
89 generation.
90
91 In clear cases you can also update requirements.txt directly. However,
92 in this case, please make sure that::
93
94   $ tox --recreate -e check-requirements
95
96 is succesful. This tool checks that the requirements-minimal.txt
97 is consistent with the requirements.txt and that all requirements in
98 requirements.txt can be really installed.
99 installed.
100
101
102 Rebuild docker image
103 --------------------
104
105 Rebuild docker image manually e.g. when changing the Dockerfile contents::
106
107   $ ./rfcli-docker-build
108
109 Unit testing
110 ------------
111
112 Unit tests can be executed with::
113
114   $ tox
115
116 Running Docker behind a proxy
117 -----------------------------
118 The 'dnf install' -command requires a proxy setting when Docker is running
119 behind a proxy.
120
121 The Dockerfile writes the proxy information to /etc/dnf/dnf.conf -file when
122 HTTP_PROXY argument is set as a --build-arg. For example::
123
124  # docker build --build-arg HTTP_PROXY=http://10.1.2.3:8080/