-
Notifications
You must be signed in to change notification settings - Fork 0
/
storage.feature
70 lines (56 loc) · 2.17 KB
/
storage.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# features/storage.feature
Feature: storage
Scenario: Store single value
Given I store the key "username" with the value "John Doe"
And the key "username" should have the value "John Doe"
Scenario: Store json
Given I store the key "name" with the value "John Doe"
Given I store the key "user" with the JSON data:
"""
{ "name": "John Doe", "age": 30 }
"""
And the key "user" should contain JSON:
"""
{ "name": "{{name}}", "age": 30 }
"""
Scenario: Load key-value pairs from a JSON file
Given I load key-value pairs from the JSON file "user.json"
Then the key "username" should have the value "john123"
And the key "user" should contain JSON:
"""
{ "name": "John Doe", "age": 30 }
"""
Scenario: Use in API call
Given I store the key "itemId" with the value "1"
Given I send a GET request to API "/item/{{itemId}}"
Then the response code should be 200
And the response should contain JSON:
"""
{ "_id": "1", "name": "test" }
"""
Scenario: Store and assert response
Given I store the key "itemId" with the value "1"
Given I send a GET request to API "/item/{{itemId}}"
And I store the response in key "itemResponse"
Then the key "itemResponse" should contain JSON:
"""
{ "_id": "1", "name": "test" }
"""
Scenario: Assert nested data
Given I load key-value pairs from the JSON file "user.json"
Given I load key-value pairs from the JSON file "item.json"
And the key "user.name" should have the value "John Doe"
And the key "items[0]._id" should have the value "1"
Scenario: Send request by extracting nested data
Given I load key-value pairs from the JSON file "item.json"
Given I send a GET request to API "/item/{{items[0]._id}}"
And I store the response in key "itemResponse"
Then the key "itemResponse" should contain JSON:
"""
{ "_id": "1", "name": "test" }
"""
Scenario: Assert truthy & falsy
Given I store the key "itemId" with the value "1"
Given I store the key "test" with the value ""
Then the key "itemId" should be truthy
Then the key "test" should be falsy