Merge "Add missing licences"
[nonrtric.git] / test / auto-test / README.md
1
2 ## Automated test Description
3 This auto-test repo stores test script for automated test cases for Policy Agent.
4 Each of the testcase script will bring up a containerized test enviroment for Policy Agent,
5 CBS, consul, and simulator(TBD).
6
7 ### Overview
8
9 Right now, test cases are written in bash scripts. \
10 Each test case script(ex. `FTC1.sh)` will call functions defined in `../common`. \
11 The environment vriables are set in`test_env.sh`. \
12 The automated test support both local build Policy Agent image testing and remote image stored in Nexus.
13 ```
14 # Local image
15 export POLICY_AGENT_LOCAL_IMAGE=o-ran-sc/nonrtric-policy-agent
16 # Remote image
17 export POLICY_AGENT_REMOTE_IMAGE=nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-policy-agent
18 ```
19 ### Test Cases Description(more TBD)
20 `FTC1.sh`: Test policy-agent can refresh configurations from consul
21
22 ### Logs
23 All log files are stored at `logs/<testcase id>`. \
24 The logs include the application.log and the container log from Policy Agent, the container logs from each simulator and the
25 test case log (same as the screen output). \
26 In the test cases the logs are stored with a prefix so the logs can be stored at different steps during the test.
27 All test cases contains an entry to save all logs with prefix 'END' at the end of each test case.
28
29 ### Manual
30 Test case command:
31 ```
32 ./<testcase-id>.sh local | remote
33
34 Discription:
35 local: test image: POLICY_AGENT_LOCAL_IMAGE=o-ran-sc/nonrtric-policy-agent
36 remote: test image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-policy-agent
37
38 ```
39
40 ### Test case categories
41 1-99 - Basic sanity tests
42
43 100-199 - API tests
44
45 300-399 - Config changes and sync
46
47 800-899 - Stability and capacity test
48
49 900-999 - Misc test
50
51 Suites
52
53 ### Test case file
54 A test case file contains a number of steps to verify a certain functionality.
55 A description of the test case should be given to the ``TC_ONELINE_DESCR`` var. The description will be printed in
56 the test result.
57
58 The empty template for a test case files looks like this:
59
60 (Only the parts noted with < and > shall be changed.)
61
62 -----------------------------------------------------------
63 ```
64 #!/usr/bin/env bash
65
66 TC_ONELINE_DESCR="<test case description>"
67
68 . ../common/testcase_common.sh $1
69
70 #### TEST BEGIN ####
71
72
73 <tests here>
74
75
76 #### TEST COMPLETE ####
77
78 store_logs          END
79
80 ```
81 -----------------------------------------------------------
82
83 The ../common/testcase_common.sh contains all functions needed for the test case file. See the README.md file in
84 the ../common dir for a description of all available functions.
85
86 ## License
87
88 Copyright (C) 2020 Nordix Foundation. All rights reserved.
89 Licensed under the Apache License, Version 2.0 (the "License");
90 you may not use this file except in compliance with the License.
91 You may obtain a copy of the License at
92
93      http://www.apache.org/licenses/LICENSE-2.0
94
95 Unless required by applicable law or agreed to in writing, software
96 distributed under the License is distributed on an "AS IS" BASIS,
97 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
98 See the License for the specific language governing permissions and
99 limitations under the License.