github.com/ixpectus/declarate@v0.0.0-20240422152255-708027d7c068/tests/yaml_example/example.yaml (about) 1 - variables: 2 cmd: "./build/main" 3 4 - name: test dry run for directory 5 shell_cmd: | 6 {{$cmd}} -dryRun -dir ./tests/yaml 7 shell_response: | 8 tests to run 9 ./tests/yaml/config.yaml 10 ./tests/yaml/db.yaml 11 ./tests/yaml/nested/nested.yaml 12 ./tests/yaml/req.yaml 13 ./tests/yaml/shell.yaml 14 15 - name: test dry run for single file 16 shell_cmd: | 17 {{$cmd}} -dryRun -dir ./tests/yaml/req.yaml 18 shell_response: | 19 tests to run 20 ./tests/yaml/req.yaml 21 22 - name: test dry run for directory with skipped files 23 shell_cmd: | 24 {{$cmd}} -dryRun -dir ./tests/yaml -s req.yaml -s db.yaml 25 shell_response: | 26 tests to run 27 ./tests/yaml/config.yaml 28 ./tests/yaml/nested/nested.yaml 29 ./tests/yaml/shell.yaml 30 31 - name: test requests success 32 shell_cmd: | 33 {{$cmd}} -dir ./tests/yaml/req.yaml 34 shell_response: | 35 passed ./tests/yaml/req.yaml:set variables 36 passed ./tests/yaml/req.yaml:check request 37 passed ./tests/yaml/req.yaml:check request 38 39 - name: test requests faile with wrong status 40 shell_cmd: | 41 {{$cmd}} -dir ./tests/yaml_failed/req_status.yaml 42 shell_response: | 43 passed ./tests/yaml_failed/req_status.yaml:set variables 44 failed ./tests/yaml_failed/req_status.yaml:check request 45 response differs: 46 status differs, expected 201, got 200 47 48 expected response: 49 {"body":{"age":28,"items":[1,2,3,4],"name":"Tom"},"status":200} 50 actual response: 51 {"body":{"age":28,"items":[1,2,3,4],"name":"Tom"},"status":201} 52 53 54 - name: test requests fail, wrong value in map 55 shell_cmd: | 56 {{$cmd}} -dir ./tests/yaml_failed/req_map.yaml 57 shell_response: | 58 failed ./tests/yaml_failed/req_map.yaml:check request fail map 59 response differs: 60 at path $.name values do not match: 61 expected: 62 Tom1 63 actual: 64 Tom 65 66 expected response: 67 {"age":28,"items":[1,2,3,4],"name":"Tom1"} 68 actual response: 69 {"age":28,"items":[1,2,3,4],"name":"Tom"} 70 71 72 73 - name: test requests fail, wrong value in array 74 shell_cmd: | 75 {{$cmd}} -dir ./tests/yaml_failed/req_array.yaml 76 shell_response: | 77 failed ./tests/yaml_failed/req_array.yaml:check request fail map 78 response differs: 79 at path $.items array lengths do not match: 80 expected: 81 3 82 actual: 83 4 84 85 expected response: 86 {"age":28,"items":[1,3,4],"name":"Tom"} 87 actual response: 88 {"age":28,"items":[1,2,3,4],"name":"Tom"} 89 90 91 92 93 - name: test db success 94 shell_cmd: | 95 {{$cmd}} -dir ./tests/yaml/db.yaml 96 shell_response: | 97 passed ./tests/yaml/db.yaml:set variables 98 start ./tests/yaml/db.yaml:create and populate table 99 passed ./tests/yaml/db.yaml:tear up, drop table 100 passed ./tests/yaml/db.yaml:create table 101 passed ./tests/yaml/db.yaml:populate with data 102 passed ./tests/yaml/db.yaml:get count 103 passed ./tests/yaml/db.yaml:get count 2 104 passed ./tests/yaml/db.yaml:create and populate table 105 passed ./tests/yaml/db.yaml:check values in table 106 107 echo 1 108 passed ./tests/yaml/db.yaml:show count plain 109 110 echo 1 111 passed ./tests/yaml/db.yaml:show count 112 passed ./tests/yaml/db.yaml:drop table 113 114 115 - name: test poll success 116 shell_cmd: | 117 {{$cmd}} -dir ./tests/yaml_poll/poll.yaml 118 shell_response: | 119 start ./tests/yaml_poll/poll.yaml:check poll handler 120 poll ./tests/yaml_poll/poll.yaml:check poll handler, wait 10ms, estimated 0s 121 poll ./tests/yaml_poll/poll.yaml:check poll handler, wait 10ms, estimated 0s 122 poll ./tests/yaml_poll/poll.yaml:check poll handler, wait 10ms, estimated 0s 123 poll ./tests/yaml_poll/poll.yaml:check poll handler, wait 10ms, estimated 0s 124 poll ./tests/yaml_poll/poll.yaml:check poll handler, wait 10ms, estimated 0s 125 poll ./tests/yaml_poll/poll.yaml:check poll handler, wait 10ms, estimated 0s 126 poll ./tests/yaml_poll/poll.yaml:check poll handler, wait 10ms, estimated 0s 127 poll ./tests/yaml_poll/poll.yaml:check poll handler, wait 10ms, estimated 0s 128 passed ./tests/yaml_poll/poll.yaml:check poll handler 129 start ./tests/yaml_poll/poll.yaml:check poll handler with regexp success 130 poll ./tests/yaml_poll/poll.yaml:check poll handler with regexp success, wait 10ms, estimated 0s 131 poll ./tests/yaml_poll/poll.yaml:check poll handler with regexp success, wait 10ms, estimated 0s 132 poll ./tests/yaml_poll/poll.yaml:check poll handler with regexp success, wait 10ms, estimated 0s 133 poll ./tests/yaml_poll/poll.yaml:check poll handler with regexp success, wait 10ms, estimated 0s 134 poll ./tests/yaml_poll/poll.yaml:check poll handler with regexp success, wait 10ms, estimated 0s 135 poll ./tests/yaml_poll/poll.yaml:check poll handler with regexp success, wait 10ms, estimated 0s 136 poll ./tests/yaml_poll/poll.yaml:check poll handler with regexp success, wait 10ms, estimated 0s 137 poll ./tests/yaml_poll/poll.yaml:check poll handler with regexp success, wait 10ms, estimated 0s 138 passed ./tests/yaml_poll/poll.yaml:check poll handler with regexp success 139 start ./tests/yaml_poll/poll.yaml:check poll handler with regexp success with response body 140 poll ./tests/yaml_poll/poll.yaml:check poll handler with regexp success with response body, wait 10ms, estimated 0s 141 poll ./tests/yaml_poll/poll.yaml:check poll handler with regexp success with response body, wait 10ms, estimated 0s 142 poll ./tests/yaml_poll/poll.yaml:check poll handler with regexp success with response body, wait 10ms, estimated 0s 143 poll ./tests/yaml_poll/poll.yaml:check poll handler with regexp success with response body, wait 10ms, estimated 0s 144 at path $.body.name values do not match: 145 expected: 146 Tom 147 actual: 148 Tommy 149 150 151 - name: test tags, pass existing tags 152 shell_cmd: | 153 {{$cmd}} -dir ./tests/yaml -tags "base,advanced" -dryRun 154 shell_response: | 155 tests to run 156 ./tests/yaml/config.yaml 157 ./tests/yaml/db.yaml 158 ./tests/yaml/req.yaml 159 160 - name: test tags, pass one tag 161 shell_cmd: | 162 {{$cmd}} -dir ./tests/yaml -tags "base" -dryRun 163 shell_response: | 164 tests to run 165 ./tests/yaml/config.yaml 166 ./tests/yaml/db.yaml 167 168 - name: test tags, tests should be ordered by tags 169 shell_cmd: | 170 {{$cmd}} -dir ./tests/yaml -tags "advanced,base" -dryRun 171 shell_response: | 172 tests to run 173 ./tests/yaml/req.yaml 174 ./tests/yaml/config.yaml 175 ./tests/yaml/db.yaml 176 177 - name: test tags, nested directories 178 shell_cmd: | 179 {{$cmd}} -dir ./tests/yaml -tags "tiny" -dryRun 180 shell_response: | 181 tests to run 182 ./tests/yaml/nested/nested.yaml 183 184 - name: test pathes, pathes and tags 185 shell_cmd: | 186 {{$cmd}} -dir ./tests/yaml -tags "base" -dryRun -tests req,nested 187 shell_response: | 188 tests to run 189 ./tests/yaml/config.yaml 190 ./tests/yaml/db.yaml 191 ./tests/yaml/req.yaml 192 ./tests/yaml/nested/nested.yaml 193 194 - name: test pathes, only pathes 195 shell_cmd: | 196 {{$cmd}} -dir ./tests/yaml -dryRun -tests req,nested 197 shell_response: | 198 tests to run 199 ./tests/yaml/req.yaml 200 ./tests/yaml/nested/nested.yaml 201 202 - name: test script, success 203 shell_cmd: | 204 {{$cmd}} -dir ./tests -tests yaml_script/script_success 205 shell_response: | 206 passed ./tests/yaml_script/script_success.yaml:set variables 207 passed ./tests/yaml_script/script_success.yaml:script check 208 209 echo reddy 210 211 passed ./tests/yaml_script/script_success.yaml:check output 212 passed ./tests/yaml_script/script_success.yaml:script check extended 213 214 echo bobby 215 216 passed ./tests/yaml_script/script_success.yaml:check output extended 217 218 219 - name: test eval 220 shell_cmd: | 221 {{$cmd}} -dir ./tests -tests yaml_variables 222 shell_response: | 223 passed ./tests/yaml_variables/1_persistent_set.yaml:set variables 224 225 echo bor 226 passed ./tests/yaml_variables/1_persistent_set.yaml:check echo variables 227 228 echo Donny 229 passed ./tests/yaml_variables/1_persistent_set.yaml:check echo persistent variable 230 231 echo qwerty 232 passed ./tests/yaml_variables/1_persistent_set.yaml:check echo persistent variable 233 234 echo qwerty 235 passed ./tests/yaml_variables/2_persistent_get.yaml:get persistent variable 236 passed ./tests/yaml_variables/eval.yaml:set variables 237 238 echo Donny 239 passed ./tests/yaml_variables/eval.yaml:check echo 240 241 echo 2 242 passed ./tests/yaml_variables/eval.yaml:check eval direct call 243 244 245 - name: test debug wrapper 246 shell_cmd: | 247 {{$cmd}} -dir ./tests -tests yaml_wrapper 248 shell_response: | 249 before test set variables 250 after test set variables 251 passed ./tests/yaml_wrapper/wrapper.yaml:set variables 252 before test check request 2 253 after test check request 2 254 passed ./tests/yaml_wrapper/wrapper.yaml:check request 2 255 before test nested steps 256 start ./tests/yaml_wrapper/wrapper.yaml:nested steps 257 before test step check request nested1 258 after test step check request nested1 259 passed ./tests/yaml_wrapper/wrapper.yaml:check request nested1 260 before test step check request nested2 261 after test step check request nested2 262 passed ./tests/yaml_wrapper/wrapper.yaml:check request nested2 263 after test nested steps 264 passed ./tests/yaml_wrapper/wrapper.yaml:nested steps 265 266 267 - name: check conditions 268 shell_cmd: | 269 {{$cmd}} -dir ./tests/yaml_definition/definition.yaml 270 shell_response: | 271 skipped for file ./tests/yaml_definition/definition.yaml: step should be skipped 272 passed ./tests/yaml_definition/definition.yaml:step should not be skipped 273 start ./tests/yaml_definition/definition.yaml:check steps behaviour 274 skipped ./tests/yaml_definition/definition.yaml: step should be skipped in steps 275 passed ./tests/yaml_definition/definition.yaml:step should not be skipped in steps 276 passed ./tests/yaml_definition/definition.yaml:check steps behaviour 277 278