Update Functest documentation for Euphrates
[functest.git] / docs / testing / user / userguide / runfunctest.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3
4
5 Executing Functest suites
6 =========================
7
8 As mentioned in the configuration guide `[1]`_, Alpine docker containers have
9 been introduced in Euphrates.
10 Tier containers have been created.
11 Assuming that you pulled the container and your environement is ready, you can
12 simply run the tiers by typing (e.g. with functest-healthcheck)::
13
14   sudo docker run --env-file env \
15       -v $(pwd)/openstack.creds:/home/opnfv/functest/conf/openstack.creds  \
16       -v $(pwd)/images:/home/opnfv/functest/images  \
17       opnfv/functest-healthcheck
18
19 You should get::
20
21   +----------------------------+------------------+---------------------+------------------+----------------+
22   |         TEST CASE          |     PROJECT      |         TIER        |     DURATION     |     RESULT     |
23   +----------------------------+------------------+---------------------+------------------+----------------+
24   |      connection_check      |     functest     |     healthcheck     |      00:02       |      PASS      |
25   |         api_check          |     functest     |     healthcheck     |      03:19       |      PASS      |
26   |     snaps_health_check     |     functest     |     healthcheck     |      00:46       |      PASS      |
27   +----------------------------+------------------+---------------------+------------------+----------------+
28
29 You can run functest-healcheck, functest-smoke, functest-features,
30 functest-components and functest-vnf.
31
32 The result tables show the results by test case, it can be::
33
34   * PASS
35   * FAIL
36   * SKIP: if the scenario/installer does not support the test case
37
38
39 Manual run
40 ==========
41 If you want to run the test step by step, you may add docker option then run the
42 different commands within the docker.
43
44 Considering the healthcheck example, running functest manaully means::
45
46   sudo docker run -ti --env-file env \
47     -v $(pwd)/openstack.creds:/home/opnfv/functest/conf/openstack.creds  \
48     -v $(pwd)/images:/home/opnfv/functest/images  \
49     opnfv/functest-healthcheck /bin/bash
50
51 The docker prompt shall be returned. Then within the docker run the following
52 commands::
53
54   $ source /home/opnfv/functest/conf/openstack.creds
55
56 Prepare environment
57 -------------------
58 Prior to commencing the Functest environment preparation, we can check
59 the initial status of the environment. Issue the **functest env status**
60 command at the prompt::
61
62   # functest env status
63   # Functest environment is not installed.
64
65 To prepare the Functest docker container for test case execution, type::
66
67   # functest env prepare
68   # ...
69   # Functest environment ready to run tests.
70
71 you may also type prepare_env instead of functest env prepare.
72
73 To list some basic information about an already prepared Functest
74 docker container environment, issue the **functest env show** at the
75 prompt::
76   bash-4.3# functest env show
77   +------------------------------+---------------------------------+
78   |     FUNCTEST ENVIRONMENT     |              VALUE              |
79   +------------------------------+---------------------------------+
80   |            STATUS            |              ready              |
81   |           SCENARIO           |     os-nosdn-nofeature-noha     |
82   |          DEBUG FLAG          |              false              |
83   |          BUILD_TAG           |               None              |
84   |          INSTALLER           |              compass            |
85   |             POD              |           huawei-pod1           |
86   +------------------------------+---------------------------------+
87
88 See configuration guide for details on Functest environnement variables.
89
90 Tier
91 ----
92 Each Alpine container provided on the docker hub matches with a tier.
93 The following commands are available::
94
95   # functest tier list
96     - 0. healthcheck:
97     ['connection_check', 'api_check', 'snaps_health_check']
98   # functest tier show healthcheck
99   +---------------------+---------------+--------------------------+-------------------------------------------------+------------------------------------+
100   |        TIERS        |     ORDER     |         CI LOOP          |                   DESCRIPTION                   |             TESTCASES              |
101   +---------------------+---------------+--------------------------+-------------------------------------------------+------------------------------------+
102   |     healthcheck     |       0       |     (daily)|(weekly)     |     First tier to be executed to verify the     |     connection_check api_check     |
103   |                     |               |                          |           basic operations in the VIM.          |         snaps_health_check         |
104   +---------------------+---------------+--------------------------+-------------------------------------------------+------------------------------------+
105
106 To run all the cases of the tier, type::
107
108   # functest tier run healthcheck
109
110 Testcase
111 --------
112 Testcases can be listed, shown and run though the CLI::
113
114   # functest testcase list
115    connection_check
116    api_check
117    snaps_health_check
118   # functest testcase show api_check
119   +-------------------+--------------------------------------------------+------------------+---------------------------+
120   |     TEST CASE     |                   DESCRIPTION                    |     CRITERIA     |         DEPENDENCY        |
121   +-------------------+--------------------------------------------------+------------------+---------------------------+
122   |     api_check     |     This test case verifies the retrieval of     |       100        |     ^((?!netvirt).)*$     |
123   |                   |       OpenStack clients: Keystone, Glance,       |                  |                           |
124   |                   |      Neutron and Nova and may perform some       |                  |                           |
125   |                   |     simple queries. When the config value of     |                  |                           |
126   |                   |       snaps.use_keystone is True, functest       |                  |                           |
127   |                   |     must have access to the cloud's private      |                  |                           |
128   |                   |                     network.                     |                  |                           |
129   +-------------------+--------------------------------------------------+------------------+---------------------------+
130   # functest testcase run connection_check
131   ...
132   # functest run all
133
134 You can also type run_tests -t all to run all the tests.
135
136 Note the list of test cases depend on the installer and the scenario.
137
138
139 Reporting results to the test Database
140 ======================================
141 In OPNFV CI we collect all the results from CI. A test APi shall be available
142 as well as a test database `[17]`_.
143
144 Functest internal API
145 =====================
146
147 An internal API has been introduced in Euphrates. The goal is to trigger
148 Functest operations through an API in addition of the CLI.
149 This could be considered as a first step towards a pseudo micro services
150 approach where the different test projects could expose and consume APIs to the
151 other test projects.
152
153 In Euphrates the main method of the APIs are:
154
155   * Show credentials
156   * Update openrc file
157   * Show environment
158   * Update hosts info for domain name
159   * Prepare environment
160   * List all testcases
161   * Show a testcase
162   * Run a testcase
163   * List all tiers
164   * Show a tier
165   * List all testcases within given tier
166   * Get the result of the specified task
167   * Get the log of the specified task
168
169 See `[16]`_ to get examples on how to use the API.
170
171
172 .. _`[1]`: http://docs.opnfv.org/en/latest/submodules/functest/docs/testing/user/configguide/index.html
173 .. _`[16]`: https://wiki.opnfv.org/display/functest/Running+test+cases+via+new+Functest+REST+API
174 .. _`[17]`: http://docs.opnfv.org/en/latest/testing/testing-dev.html