|
1 | | -Feature: Redis Mock Testing |
| 1 | +@needs-redis |
| 2 | +Feature: Redis Testing |
2 | 3 | As a developer |
3 | | - I want to have reliable Redis mocks for testing |
4 | | - So that I can write tests without a real Redis server |
| 4 | + I want to test Redis operations with both mocks and real containers |
| 5 | + So that I can ensure compatibility and reliability across different environments |
5 | 6 |
|
6 | 7 | Background: |
7 | 8 | Given test entities are defined |
8 | 9 |
|
9 | | - Scenario: Store and retrieve a simple key-value pair with Redis mock |
10 | | - Given a configured Redis mock |
11 | | - When I store the key "user-id" with value "12345" in Redis mock |
| 10 | + Scenario Outline: Store and retrieve a simple key-value pair |
| 11 | + Given a configured <adapter_type> |
| 12 | + When I store the key "user-id" with value "12345" in <adapter_type> |
12 | 13 | Then the sync store operation should succeed |
13 | | - When I retrieve the value for key "user-id" from Redis mock |
| 14 | + When I retrieve the value for key "user-id" from <adapter_type> |
14 | 15 | Then the sync retrieved value should be "12345" |
15 | 16 |
|
16 | | - Scenario: Remove a key with Redis mock |
17 | | - Given a configured Redis mock |
18 | | - When I store the key "session-token" with value "abcde" in Redis mock |
| 17 | + Examples: Adapter Types |
| 18 | + | adapter_type | |
| 19 | + | mock | |
| 20 | + | container | |
| 21 | + |
| 22 | + Scenario Outline: Remove a key |
| 23 | + Given a configured <adapter_type> |
| 24 | + When I store the key "session-token" with value "abcde" in <adapter_type> |
19 | 25 | Then the sync store operation should succeed |
20 | | - When I remove the key "session-token" from Redis mock |
| 26 | + When I remove the key "session-token" from <adapter_type> |
21 | 27 | Then the sync remove operation should delete one key |
22 | | - When I check if "session-token" exists in Redis mock |
| 28 | + When I check if "session-token" exists in <adapter_type> |
23 | 29 | Then the sync key should not exist |
24 | 30 |
|
25 | | - Scenario: Manage a list of items with Redis mock |
26 | | - Given a configured Redis mock |
27 | | - When I add "apple, banana, orange" to the list "fruits" in Redis mock |
| 31 | + Examples: Adapter Types |
| 32 | + | adapter_type | |
| 33 | + | mock | |
| 34 | + | container | |
| 35 | + |
| 36 | + Scenario Outline: Manage a list of items |
| 37 | + Given a configured <adapter_type> |
| 38 | + When I add "apple, banana, orange" to the list "fruits" in <adapter_type> |
28 | 39 | Then the sync list "fruits" should have 3 items |
29 | | - When I fetch all items from the list "fruits" in Redis mock |
| 40 | + When I fetch all items from the list "fruits" in <adapter_type> |
30 | 41 | Then the sync list "fruits" should contain "apple, banana, orange" |
31 | 42 |
|
32 | | - Scenario: Handle a hash structure with Redis mock |
33 | | - Given a configured Redis mock |
34 | | - When I assign "name" to "Alice" in the hash "profile" in Redis mock |
| 43 | + Examples: Adapter Types |
| 44 | + | adapter_type | |
| 45 | + | mock | |
| 46 | + | container | |
| 47 | + |
| 48 | + Scenario Outline: Handle a hash structure |
| 49 | + Given a configured <adapter_type> |
| 50 | + When I assign "name" to "Alice" in the hash "profile" in <adapter_type> |
35 | 51 | Then the sync hash assignment should succeed |
36 | | - When I retrieve the "name" field from the hash "profile" in Redis mock |
| 52 | + When I retrieve the "name" field from the hash "profile" in <adapter_type> |
37 | 53 | Then the sync retrieved field value should be "Alice" |
38 | 54 |
|
39 | | - Scenario: Manage a set of colors with Redis mock |
40 | | - Given a configured Redis mock |
41 | | - When I add "red, blue, green" to the set "colors" in Redis mock |
| 55 | + Examples: Adapter Types |
| 56 | + | adapter_type | |
| 57 | + | mock | |
| 58 | + | container | |
| 59 | + |
| 60 | + Scenario Outline: Manage a set of colors |
| 61 | + Given a configured <adapter_type> |
| 62 | + When I add "red, blue, green" to the set "colors" in <adapter_type> |
42 | 63 | Then the sync set "colors" should have 3 members |
43 | | - When I fetch all members from the set "colors" in Redis mock |
| 64 | + When I fetch all members from the set "colors" in <adapter_type> |
44 | 65 | Then the sync set "colors" should contain "red, blue, green" |
45 | 66 |
|
| 67 | + Examples: Adapter Types |
| 68 | + | adapter_type | |
| 69 | + | mock | |
| 70 | + | container | |
| 71 | + |
46 | 72 | @async |
47 | | - Scenario: Store and retrieve a key-value pair asynchronously with Redis mock |
48 | | - Given a configured async Redis mock |
49 | | - When I store the key "order-id" with value "67890" in async Redis mock |
| 73 | + Scenario Outline: Store and retrieve a key-value pair asynchronously |
| 74 | + Given a configured async <adapter_type> |
| 75 | + When I store the key "order-id" with value "67890" in async <adapter_type> |
50 | 76 | Then the async store operation should succeed |
51 | | - When I retrieve the value for key "order-id" from async Redis mock |
| 77 | + When I retrieve the value for key "order-id" from async <adapter_type> |
52 | 78 | Then the async retrieved value should be "67890" |
53 | 79 |
|
| 80 | + Examples: Adapter Types |
| 81 | + | adapter_type | |
| 82 | + | mock | |
| 83 | + | container | |
| 84 | + |
54 | 85 | @async |
55 | | - Scenario: Remove a key asynchronously with Redis mock |
56 | | - Given a configured async Redis mock |
57 | | - When I store the key "cache-key" with value "xyz" in async Redis mock |
| 86 | + Scenario Outline: Remove a key asynchronously |
| 87 | + Given a configured async <adapter_type> |
| 88 | + When I store the key "cache-key" with value "xyz" in async <adapter_type> |
58 | 89 | Then the async store operation should succeed |
59 | | - When I remove the key "cache-key" from async Redis mock |
| 90 | + When I remove the key "cache-key" from async <adapter_type> |
60 | 91 | Then the async remove operation should delete one key |
61 | | - When I check if "cache-key" exists in async Redis mock |
| 92 | + When I check if "cache-key" exists in async <adapter_type> |
62 | 93 | Then the async key should not exist |
63 | 94 |
|
| 95 | + Examples: Adapter Types |
| 96 | + | adapter_type | |
| 97 | + | mock | |
| 98 | + | container | |
| 99 | + |
64 | 100 | @async |
65 | | - Scenario: Manage a list of tasks asynchronously with Redis mock |
66 | | - Given a configured async Redis mock |
67 | | - When I add "task1, task2, task3" to the list "tasks" in async Redis mock |
| 101 | + Scenario Outline: Manage a list of tasks asynchronously |
| 102 | + Given a configured async <adapter_type> |
| 103 | + When I add "task1, task2, task3" to the list "tasks" in async <adapter_type> |
68 | 104 | Then the async list "tasks" should have 3 items |
69 | | - When I fetch all items from the list "tasks" in async Redis mock |
| 105 | + When I fetch all items from the list "tasks" in async <adapter_type> |
70 | 106 | Then the async list "tasks" should contain "task1, task2, task3" |
71 | 107 |
|
| 108 | + Examples: Adapter Types |
| 109 | + | adapter_type | |
| 110 | + | mock | |
| 111 | + | container | |
| 112 | + |
72 | 113 | @async |
73 | | - Scenario: Handle a hash structure asynchronously with Redis mock |
74 | | - Given a configured async Redis mock |
75 | | - When I assign "email" to "bob@example.com" in the hash "contact" in async Redis mock |
| 114 | + Scenario Outline: Handle a hash structure asynchronously |
| 115 | + Given a configured async <adapter_type> |
| 116 | + When I assign "email" to "bob@example.com" in the hash "contact" in async <adapter_type> |
76 | 117 | Then the async hash assignment should succeed |
77 | | - When I retrieve the "email" field from the hash "contact" in async Redis mock |
| 118 | + When I retrieve the "email" field from the hash "contact" in async <adapter_type> |
78 | 119 | Then the async retrieved field value should be "bob@example.com" |
79 | 120 |
|
| 121 | + Examples: Adapter Types |
| 122 | + | adapter_type | |
| 123 | + | mock | |
| 124 | + | container | |
| 125 | + |
80 | 126 | @async |
81 | | - Scenario: Manage a set of tags asynchronously with Redis mock |
82 | | - Given a configured async Redis mock |
83 | | - When I add "tag1, tag2, tag3" to the set "tags" in async Redis mock |
| 127 | + Scenario Outline: Manage a set of tags asynchronously |
| 128 | + Given a configured async <adapter_type> |
| 129 | + When I add "tag1, tag2, tag3" to the set "tags" in async <adapter_type> |
84 | 130 | Then the async set "tags" should have 3 members |
85 | | - When I fetch all members from the set "tags" in async Redis mock |
| 131 | + When I fetch all members from the set "tags" in async <adapter_type> |
86 | 132 | Then the async set "tags" should contain "tag1, tag2, tag3" |
| 133 | + |
| 134 | + Examples: Adapter Types |
| 135 | + | adapter_type | |
| 136 | + | mock | |
| 137 | + | container | |
0 commit comments