|
| 1 | +Feature: V4 era Matching Rules |
| 2 | + |
| 3 | + Scenario: Supports a status code matcher (positive case) |
| 4 | + Given an expected response configured with the following: |
| 5 | + | status | matching rules | |
| 6 | + | 200 | statuscode-matcher-v4.json | |
| 7 | + And a status 299 response is received |
| 8 | + When the response is compared to the expected one |
| 9 | + Then the response comparison should be OK |
| 10 | + |
| 11 | + Scenario: Supports a status code matcher (negative case) |
| 12 | + Given an expected response configured with the following: |
| 13 | + | status | matching rules | |
| 14 | + | 200 | statuscode-matcher-v4.json | |
| 15 | + And a status 400 response is received |
| 16 | + When the response is compared to the expected one |
| 17 | + Then the response comparison should NOT be OK |
| 18 | + And the response mismatches will contain a "status" mismatch with error "expected Successful response (200–299) but was 400" |
| 19 | + |
| 20 | + Scenario: Supports a not empty matcher (positive case) |
| 21 | + Given an expected request configured with the following: |
| 22 | + | body | matching rules | |
| 23 | + | JSON: { "one": "", "two": ["b"] } | notempty-matcher-v4.json | |
| 24 | + And a request is received with the following: |
| 25 | + | body | |
| 26 | + | JSON: { "one": "cat", "two": ["rat"] } | |
| 27 | + When the request is compared to the expected one |
| 28 | + Then the comparison should be OK |
| 29 | + |
| 30 | + Scenario: Supports a not empty matcher with binary data (positive case) |
| 31 | + Given an expected request configured with the following: |
| 32 | + | body | matching rules | |
| 33 | + | file: rat.jpg | notempty2-matcher-v4.json | |
| 34 | + And a request is received with the following: |
| 35 | + | body | |
| 36 | + | file: spider.jpg | |
| 37 | + When the request is compared to the expected one |
| 38 | + Then the comparison should be OK |
| 39 | + |
| 40 | + Scenario: Supports a not empty matcher (negative case) |
| 41 | + Given an expected request configured with the following: |
| 42 | + | body | matching rules | |
| 43 | + | JSON: { "one": "a", "two": ["b"] } | notempty-matcher-v4.json | |
| 44 | + And a request is received with the following: |
| 45 | + | body | |
| 46 | + | JSON: { "one": "", "two": [] } | |
| 47 | + When the request is compared to the expected one |
| 48 | + Then the comparison should NOT be OK |
| 49 | + And the mismatches will contain a mismatch with error "$.one" -> "Expected '' (String) to not be empty" |
| 50 | + And the mismatches will contain a mismatch with error "$.two" -> "Expected [] (ArrayList) to not be empty" |
| 51 | + |
| 52 | + Scenario: Supports a not empty matcher (negative case 2, types are different) |
| 53 | + Given an expected request configured with the following: |
| 54 | + | body | matching rules | |
| 55 | + | JSON: { "one": "a", "two": ["b"] } | notempty-matcher-v4.json | |
| 56 | + And a request is received with the following: |
| 57 | + | body | |
| 58 | + | JSON: { "one": "a", "two": "b" } | |
| 59 | + When the request is compared to the expected one |
| 60 | + Then the comparison should NOT be OK |
| 61 | + And the mismatches will contain a mismatch with error "$.two" -> "Type mismatch: Expected String 'b' to be equal to List [\"b\"]" |
| 62 | + |
| 63 | + Scenario: Supports a not empty matcher with binary data (negative case) |
| 64 | + Given an expected request configured with the following: |
| 65 | + | body | matching rules | |
| 66 | + | file: rat.jpg | notempty2-matcher-v4.json | |
| 67 | + And a request is received with the following: |
| 68 | + | body | |
| 69 | + | | |
| 70 | + When the request is compared to the expected one |
| 71 | + Then the comparison should NOT be OK |
| 72 | + And the mismatches will contain a mismatch with error "$" -> "Expected 0 byte(s) (byte[]) to not be empty" |
| 73 | + |
| 74 | + Scenario: Supports a semver matcher (positive case) |
| 75 | + Given an expected request configured with the following: |
| 76 | + | body | matching rules | |
| 77 | + | file: basic.json | semver-matcher-v4.json | |
| 78 | + And a request is received with the following: |
| 79 | + | body | |
| 80 | + | JSON: { "one": "1.0.0", "two": "2.0.0" } | |
| 81 | + When the request is compared to the expected one |
| 82 | + Then the comparison should be OK |
| 83 | + |
| 84 | + Scenario: Supports a semver matcher (negative case) |
| 85 | + Given an expected request configured with the following: |
| 86 | + | body | matching rules | |
| 87 | + | file: basic.json | semver-matcher-v4.json | |
| 88 | + And a request is received with the following: |
| 89 | + | body | |
| 90 | + | JSON: { "one": "1.0", "two": "1.0abc" } | |
| 91 | + When the request is compared to the expected one |
| 92 | + Then the comparison should NOT be OK |
| 93 | + And the mismatches will contain a mismatch with error "$.one" -> "Expected '1.0' (String) to be a semantic version" |
| 94 | + And the mismatches will contain a mismatch with error "$.two" -> "Expected '1.0abc' (String) to be a semantic version" |
0 commit comments