Merge "Remove prepare_env"
[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 Tier
57 ----
58 Each Alpine container provided on the docker hub matches with a tier.
59 The following commands are available::
60
61   # functest tier list
62     - 0. healthcheck:
63     ['connection_check', 'api_check', 'snaps_health_check']
64   # functest tier show healthcheck
65   +---------------------+---------------+--------------------------+-------------------------------------------------+------------------------------------+
66   |        TIERS        |     ORDER     |         CI LOOP          |                   DESCRIPTION                   |             TESTCASES              |
67   +---------------------+---------------+--------------------------+-------------------------------------------------+------------------------------------+
68   |     healthcheck     |       0       |     (daily)|(weekly)     |     First tier to be executed to verify the     |     connection_check api_check     |
69   |                     |               |                          |           basic operations in the VIM.          |         snaps_health_check         |
70   +---------------------+---------------+--------------------------+-------------------------------------------------+------------------------------------+
71
72 To run all the cases of the tier, type::
73
74   # functest tier run healthcheck
75
76 Testcase
77 --------
78 Testcases can be listed, shown and run though the CLI::
79
80   # functest testcase list
81    connection_check
82    api_check
83    snaps_health_check
84   # functest testcase show api_check
85   +-------------------+--------------------------------------------------+------------------+---------------------------+
86   |     TEST CASE     |                   DESCRIPTION                    |     CRITERIA     |         DEPENDENCY        |
87   +-------------------+--------------------------------------------------+------------------+---------------------------+
88   |     api_check     |     This test case verifies the retrieval of     |       100        |     ^((?!netvirt).)*$     |
89   |                   |       OpenStack clients: Keystone, Glance,       |                  |                           |
90   |                   |      Neutron and Nova and may perform some       |                  |                           |
91   |                   |     simple queries. When the config value of     |                  |                           |
92   |                   |       snaps.use_keystone is True, functest       |                  |                           |
93   |                   |     must have access to the cloud's private      |                  |                           |
94   |                   |                     network.                     |                  |                           |
95   +-------------------+--------------------------------------------------+------------------+---------------------------+
96   # functest testcase run connection_check
97   ...
98   # functest run all
99
100 You can also type run_tests -t all to run all the tests.
101
102 Note the list of test cases depend on the installer and the scenario.
103
104
105 Reporting results to the test Database
106 ======================================
107 In OPNFV CI we collect all the results from CI. A test APi shall be available
108 as well as a test database `[17]`_.
109
110 Functest internal API
111 =====================
112
113 An internal API has been introduced in Euphrates. The goal is to trigger
114 Functest operations through an API in addition of the CLI.
115 This could be considered as a first step towards a pseudo micro services
116 approach where the different test projects could expose and consume APIs to the
117 other test projects.
118
119 In Euphrates the main method of the APIs are:
120
121   * Show credentials
122   * Update openrc file
123   * Show environment
124   * Update hosts info for domain name
125   * Prepare environment
126   * List all testcases
127   * Show a testcase
128   * Run a testcase
129   * List all tiers
130   * Show a tier
131   * List all testcases within given tier
132   * Get the result of the specified task
133   * Get the log of the specified task
134
135 See `[16]`_ to get examples on how to use the API.
136
137
138 .. _`[1]`: http://docs.opnfv.org/en/latest/submodules/functest/docs/testing/user/configguide/index.html
139 .. _`[16]`: https://wiki.opnfv.org/display/functest/Running+test+cases+via+new+Functest+REST+API
140 .. _`[17]`: http://docs.opnfv.org/en/latest/testing/testing-dev.html