@@ -141,17 +141,25 @@ https://github.com/RedHatOfficial/GoCourse
141
141
- It is not tightly bound with any real programming language
142
142
- it can be used by non-developers
143
143
144
+
145
+
144
146
* Given-When-Then
145
147
- Semi-structured way to write down test cases
146
148
149
+
150
+
147
151
* Three clauses
148
152
- `Given`
149
153
- `When`
150
154
- `Then`
151
155
156
+
157
+
152
158
* The same clause on more consecutive lines?
153
159
- `And`
154
160
161
+
162
+
155
163
* Gherkin language - an example
156
164
157
165
Given the customer has logged into their current account
@@ -198,24 +206,79 @@ https://github.com/RedHatOfficial/GoCourse
198
206
199
207
* REST API testing
200
208
- in many aspects like software testing at UI level
201
- - instead of input-ouput testing, REST API is validated
209
+ - instead of input-output testing, REST API is validated
210
+ - very important in niche where Go language is used
211
+ - supports HTTP and HTTPS as well
212
+
213
+
202
214
203
215
* REST API testing frameworks
216
+ - several packages/frameworks are available
204
217
- Frisby
205
218
- RestIt
206
219
207
220
221
+
208
222
* Frisby
209
223
- All basic HTTP methods (GET, POST, PUT, PATCH, DELETE)
210
- - Assertions
224
+ - Built-in assertions
211
225
- JSON parser
212
226
- XML parser
227
+ - Based of 'fluent API'
228
+ - The whole test can be written as a chain of method of `*Frisby` object
229
+ - Can be used as-is or as part of unit tests (usually not recommended)
230
+
231
+
232
+
233
+ * Checking REST API with just GET method available
234
+ .play testing/frisby/02_frisby_basic_usage.go
235
+
236
+
237
+
238
+ * The same example, but with fluent API
239
+ .play testing/frisby/01_frisby_basic_usage.go
240
+
241
+
242
+
243
+ * Reporting similar to unit tests output
244
+ .play testing/frisby/03_frisby_basic_usage.go
245
+
246
+
247
+
248
+ * Behaviour when some tests fail
249
+ .play testing/frisby/04_frisby_failures.go
250
+
251
+
252
+
253
+ * Checking headers in the server response
254
+ .play testing/frisby/05_frisby_check_headers.go
255
+
256
+
257
+
258
+ * Using HTTP method POST
259
+
260
+
261
+
262
+ * Sending JSON over HTTP/HTTPS
263
+
264
+
265
+
266
+ * Checking content of HTTP response
267
+
268
+
269
+
270
+ * Basic cookies handling
271
+
272
+
273
+
274
+ * Using Frisby package in unit tests
213
275
214
276
215
277
216
278
#############################################################
217
279
218
280
* Performance analysis
281
+ - very important part of testing
219
282
220
283
221
284
0 commit comments