-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-api-manual.txt
More file actions
256 lines (228 loc) · 7.37 KB
/
test-api-manual.txt
File metadata and controls
256 lines (228 loc) · 7.37 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
ENHANCED CUSTOMER API - MANUAL TESTING GUIDE
==============================================
Copy and paste these curl commands to test all OpenAPI features
Base URL: http://localhost:8080
=== 1. BASIC CRUD OPERATIONS (Original Endpoints) ===
1.1 CREATE CUSTOMER WITH NESTED ADDRESS OBJECT
Tests: Nested objects, complex JSON structure, enum types
--------------------------------------------------
curl -X POST http://localhost:8080/customer \
-H "Content-Type: application/json" \
-d '{
"id": "CUST001",
"name": "Alice Johnson",
"address": {
"street": "123 Main St",
"city": "New York",
"state": "NY",
"zipCode": "10001",
"country": "USA"
},
"phone": "555-0123",
"type": "VIP"
}'
1.2 CREATE BUSINESS CUSTOMER
Tests: Different customer type (PREMIUM), business data
------------------------------------------------------
curl -X POST http://localhost:8080/customer \
-H "Content-Type: application/json" \
-d '{
"id": "CORP001",
"name": "Tech Solutions Inc",
"address": {
"street": "456 Business Ave",
"city": "San Francisco",
"state": "CA",
"zipCode": "94105",
"country": "USA"
},
"phone": "415-555-0100",
"type": "PREMIUM"
}'
1.3 CREATE INDIVIDUAL CUSTOMER
Tests: INDIVIDUAL customer type
-------------------------------
curl -X POST http://localhost:8080/customer \
-H "Content-Type: application/json" \
-d '{
"id": "IND001",
"name": "Bob Smith",
"address": {
"street": "789 Oak Street",
"city": "Chicago",
"state": "IL",
"zipCode": "60601",
"country": "USA"
},
"phone": "312-555-0200",
"type": "INDIVIDUAL"
}'
1.4 GET INDIVIDUAL CUSTOMER
Tests: Path parameters, single resource retrieval
-------------------------------------------------
curl -X GET http://localhost:8080/customer/CUST001 | jq '.'
1.5 UPDATE CUSTOMER
Tests: PUT operation, full replacement
--------------------------------------
curl -X PUT http://localhost:8080/customer \
-H "Content-Type: application/json" \
-d '{
"id": "CUST001",
"name": "Alice Johnson-Smith",
"address": {
"street": "456 Updated St",
"city": "New York",
"state": "NY",
"zipCode": "10002",
"country": "USA"
},
"phone": "555-0124",
"type": "PREMIUM"
}'
1.6 TEST UPDATING CUSTOMER
Tests: Path parameters, single resource retrieval
-------------------------------------------------
curl -X GET http://localhost:8080/customer/CUST001 | jq '.'
1.7 DELETE CUSTOMER
Tests: DELETE operation, resource removal
-----------------------------------------
curl -X DELETE http://localhost:8080/customer/IND001
1.8 PARTIAL UPDATE CUSTOMER (PATCH)
Tests: PATCH operation, partial field updates
--------------------------------------------
curl -X PATCH http://localhost:8080/customer/CUST001 \
-H "Content-Type: application/json" \
-d '{
"phone": "555-9999"
}' | jq '.'
1.9 PARTIAL UPDATE ADDRESS ONLY
Tests: Nested object partial updates
-----------------------------------
curl -X PATCH http://localhost:8080/customer/CORP001 \
-H "Content-Type: application/json" \
-d '{
"address": {
"city": "Los Angeles",
"state": "CA"
}
}' | jq '.'
=== 2. BATCH OPERATIONS (Create More Test Data) ===
2.1 CREATE MULTIPLE CUSTOMERS
Tests: Array handling, batch processing
---------------------------------------
curl -X POST http://localhost:8080/customers/batch \
-H "Content-Type: application/json" \
-d '[
{
"id": "BATCH001",
"name": "Batch Customer 1",
"address": {
"street": "100 Batch St",
"city": "Boston",
"state": "MA",
"zipCode": "02101",
"country": "USA"
},
"phone": "617-555-0001",
"type": "BUSINESS"
},
{
"id": "BATCH002",
"name": "Batch Customer 2",
"address": {
"street": "200 Batch Ave",
"city": "Seattle",
"state": "WA",
"zipCode": "98101",
"country": "USA"
},
"phone": "206-555-0002",
"type": "VIP"
},
{
"id": "BATCH003",
"name": "Premium Corp",
"address": {
"street": "300 Enterprise Blvd",
"city": "Austin",
"state": "TX",
"zipCode": "73301",
"country": "USA"
},
"phone": "512-555-0003",
"type": "PREMIUM"
}
]' | jq '.'
=== 3. PAGINATION & QUERY PARAMETERS ===
3.1 GET ALL CUSTOMERS (DEFAULT PAGINATION)
Tests: Pagination defaults, CustomerSummary response model
----------------------------------------------------------
curl -X GET "http://localhost:8080/customers" | jq '.'
3.2 CUSTOM PAGE SIZE
Tests: Query parameter with custom value
----------------------------------------
curl -X GET "http://localhost:8080/customers?page=0&size=2" | jq '.'
curl -X GET "http://localhost:8080/customers?page=1&size=2" | jq '.'
curl -X GET "http://localhost:8080/customers?page=2&size=2" | jq '.'
3.3 FILTER BY CUSTOMER TYPE
Tests: Enum query parameter, filtering
--------------------------------------
curl -X GET "http://localhost:8080/customers?type=VIP" | jq '.'
3.4 FILTER BY CITY
Tests: String query parameter, nested object filtering
------------------------------------------------------
curl -X GET "http://localhost:8080/customers?city=New%20York" | jq '.'
3.5 FILTER BY STATE
Tests: Additional string filter
-------------------------------
curl -X GET "http://localhost:8080/customers?state=CA" | jq '.'
3.6 MULTIPLE FILTERS COMBINED
Tests: Multiple query parameters, complex filtering
---------------------------------------------------
curl -X GET "http://localhost:8080/customers?name=Alice&type=PREMIUM&state=NY" | jq '.'
3.7 PAGINATION WITH FILTERS
Tests: Pagination combined with filtering
-----------------------------------------
curl -X GET "http://localhost:8080/customers?page=0&size=2&type=PREMIUM" | jq '.'
curl -X GET "http://localhost:8080/customers?page=1&size=2&type=PREMIUM" | jq '.'
=== 4. ADVANCED SEARCH (REQUEST BODY) ===
4.1 BASIC SEARCH
Tests: Request body search with multiple criteria
-------------------------------------------------
curl -X POST http://localhost:8080/customers/search \
-H "Content-Type: application/json" \
-d '{
"name": "Tech",
"type": "PREMIUM"
}' | jq '.'
4.2 COMPREHENSIVE SEARCH
Tests: All search criteria combined
-----------------------------------
curl -X POST http://localhost:8080/customers/search \
-H "Content-Type: application/json" \
-d '{
"name": "Alice",
"type": "PREMIUM",
"city": "New York",
"state": "NY",
"zipCode": "10002",
"phoneAreaCode": "555"
}' | jq '.'
=== OPENAPI FEATURES DEMONSTRATED ===
✅ Nested Objects (Address within Customer)
✅ Pagination Patterns with metadata
✅ Query Parameters with defaults and validation
✅ Request Body alternatives (query vs body search)
✅ Generic Response Wrappers (PaginatedResponse<T>)
✅ Different Response Models (Customer vs CustomerSummary)
✅ Batch Operations (Array handling)
✅ Partial Updates (PATCH operations)
✅ Complete CRUD Operations (Create, Read, Update, Delete)
✅ Enum Documentation and Validation
✅ Clean REST API Design Patterns
=== TIPS FOR TESTING ===
- JSON responses are formatted with | jq '.' for readability
- For Windows, replace \ with ^ for line continuation
- Test in order for best results (create before search/list)
- Some features depend on data created in earlier tests
- Install jq if needed: brew install jq (Mac) or apt install jq (Linux)