Browse Source

update testing doc

Derek Schultz 2 years ago
parent
commit
4c55f10262
1 changed files with 40 additions and 59 deletions
  1. 40
    59
      testing.md

+ 40
- 59
testing.md View File

@@ -1,28 +1,21 @@
1
-Testing
2
--------
1
+# Testing
3 2
 
4
-In order to run tests you need to install `Tox`:
3
+## Requirements
5 4
 
6
-    $ pip install tox
5
+* Install `Tox`
7 6
 
8
-Also, you will need a running MySQL instance with the database migrations applied from the previous step.
9
-Tests are dependent on pre-created MySQL database for persistence.
10
-Please set env var
7
+        $ pip install tox
11 8
 
12
-    $ export TEST_DB_URI=mysql://<your-user>:<your-user-password>@<mysql-host>:<mysql-port>/<functions-db>
9
+* MySQL instance with database migrations applied (refer to quick start guide)
13 10
 
14
-PEP8 style checks
15
------------------
11
+        $ export TEST_DB_URI=mysql://<your-user>:<your-user-password>@<mysql-host>:<mysql-port>/<functions-db>
16 12
 
17
-In order to run `PEP8` style checks run following command:
13
+### PEP8 style checks
18 14
 
19 15
     $ tox -e pep8
20 16
 
21 17
 
22
-Functional testing
23
-------------------
24
-
25
-In order to run `functional` tests run following command:
18
+### Functional testing
26 19
 
27 20
     $ tox -e py35-functional
28 21
 
@@ -38,10 +31,9 @@ Cons:
38 31
 * OpenStack authentication is not tested
39 32
 * IronFunctions API stubbed with fake implementation
40 33
 
41
-Integration integrations
42
-------------------------
34
+### Integration tests
43 35
 
44
-Integration tests are dependent on following env variables:
36
+The following env variables are required:
45 37
 
46 38
 * TEST_DB_URI - similar to functional tests, database endpoint
47 39
 * FUNCTIONS_API_URL - IronFunctions API URL (default value - `http://localhost:8080/v1`)
@@ -50,63 +42,52 @@ Integration tests are dependent on following env variables:
50 42
 * OS_USERNAME - OpenStack user name
51 43
 * OS_PASSWORD - OpenStack user user password
52 44
 
53
-To run tests use following command:
54
-
55
-    export TEST_DB_URI=mysql://<your-user>:<your-user-password>@<mysql-host>:<mysql-port>/<functions-db>
56
-    export FUNCTIONS_API_URL=<functions-api-protocol>://<functions-host>:<functions-port>/<functions-api-version>
57
-    export OS_AUTH_URL=<identity-api-protocol>://<identity-host>:<identity-port>/<identity-api-version>
58
-    export OS_PROJECT_NAME=<project-name>
59
-    export OS_USERNAME=<project-name>
60
-    export OS_PASSWORD=<project-name>
61
-    tox -epy35-integration
62
-
63
-Testing: Docker-build
64
----------------------
45
+```bash
46
+export TEST_DB_URI=mysql://<your-user>:<your-user-password>@<mysql-host>:<mysql-port>/<functions-db>
47
+export FUNCTIONS_API_URL=<functions-api-protocol>://<functions-host>:<functions-port>/<functions-api-version>
48
+export OS_AUTH_URL=<identity-api-protocol>://<identity-host>:<identity-port>/<identity-api-version>
49
+export OS_PROJECT_NAME=<project-name>
50
+export OS_USERNAME=<project-name>
51
+export OS_PASSWORD=<project-name>
52
+tox -epy35-integration
53
+```
65 54
 
66
-This type of testing allows to ensure if code can be build inside docker container with no problems.
67
-In order to run this check use following commands::
55
+### Testing: Docker-build
68 56
 
69
-    export DOCKER_HOST=tcp://<docker-host>:<docker-port>>
70
-    export TEST_DB_URI=mysql://<your-user>:<your-user-password>@<mysql-host>:<mysql-port>/<functions-db>
71
-    export FUNCTIONS_API_URL=<functions-api-protocol>://<functions-host>:<functions-port>/<functions-api-version>
72
-    export OS_AUTH_URL=<identity-api-protocol>://<identity-host>:<identity-port>/<identity-api-version>
73
-    tox -e docker-build
74
-
75
-During this check Tox:
57
+The following operations are performed:
76 58
 
77 59
 * builds an image
78 60
 * deletes all artifacts (Python3.5 image and recently built image)
79 61
 
80
-Testing Docker-full
81
--------------------
82
-
83
-This type of testing allows to ensure if code code can be build and run successfully inside docker container with no problems.
84
-In order to run this check use following commands::
62
+```bash
63
+export DOCKER_HOST=tcp://<docker-host>:<docker-port>>
64
+export TEST_DB_URI=mysql://<your-user>:<your-user-password>@<mysql-host>:<mysql-port>/<functions-db>
65
+export FUNCTIONS_API_URL=<functions-api-protocol>://<functions-host>:<functions-port>/<functions-api-version>
66
+export OS_AUTH_URL=<identity-api-protocol>://<identity-host>:<identity-port>/<identity-api-version>
67
+tox -e docker-build
68
+```
85 69
 
86
-    export DOCKER_HOST=tcp://<docker-host>:<docker-port>>
87
-    export TEST_DB_URI=mysql://<your-user>:<your-user-password>@<mysql-host>:<mysql-port>/<functions-db>
88
-    export FUNCTIONS_API_URL=<functions-api-protocol>://<functions-host>:<functions-port>/<functions-api-version>
89
-    export OS_AUTH_URL=<identity-api-protocol>://<identity-host>:<identity-port>/<identity-api-version>
90
-    tox -e docker-full
70
+### Testing Docker-full
91 71
 
92
-During this check following operations are performed::
72
+The following operations are performed:
93 73
 
94 74
 * build container from source code
95 75
 * run container with exposed ports
96 76
 * request Swagger API doc to see if API is responsive
97
-* tear-down running container
98
-
77
+* destroy running container
99 78
 
100
-Coverage regression testing
101
----------------------------
79
+```bash
80
+export DOCKER_HOST=tcp://<docker-host>:<docker-port>>
81
+export TEST_DB_URI=mysql://<your-user>:<your-user-password>@<mysql-host>:<mysql-port>/<functions-db>
82
+export FUNCTIONS_API_URL=<functions-api-protocol>://<functions-host>:<functions-port>/<functions-api-version>
83
+export OS_AUTH_URL=<identity-api-protocol>://<identity-host>:<identity-port>/<identity-api-version>
84
+tox -e docker-full
85
+```
102 86
 
103
-In order to build quality software it is necessary to keep test coverage at its highest point.
104
-So, as part of `Tox` testing new check was added - functional test coverage regression.
105
-In order to run it use following command:
87
+### Coverage regression testing
106 88
 
107 89
     $ tox -e py35-functional-regression
108 90
 
109
-Static code analysis with Bandit
110
-================================
91
+### Static code analysis with Bandit
111 92
 
112 93
     $ tox -e bandit

Loading…
Cancel
Save