Skip to content

Commit 6bbb296

Browse files
committed
Frisby + REST API testing, basic examples
1 parent 1fe535e commit 6bbb296

File tree

1 file changed

+65
-2
lines changed

1 file changed

+65
-2
lines changed

testing.slide

+65-2
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,25 @@ https://github.com/RedHatOfficial/GoCourse
141141
- It is not tightly bound with any real programming language
142142
- it can be used by non-developers
143143

144+
145+
144146
* Given-When-Then
145147
- Semi-structured way to write down test cases
146148

149+
150+
147151
* Three clauses
148152
- `Given`
149153
- `When`
150154
- `Then`
151155

156+
157+
152158
* The same clause on more consecutive lines?
153159
- `And`
154160

161+
162+
155163
* Gherkin language - an example
156164

157165
Given the customer has logged into their current account
@@ -198,24 +206,79 @@ https://github.com/RedHatOfficial/GoCourse
198206

199207
* REST API testing
200208
- 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+
202214

203215
* REST API testing frameworks
216+
- several packages/frameworks are available
204217
- Frisby
205218
- RestIt
206219

207220

221+
208222
* Frisby
209223
- All basic HTTP methods (GET, POST, PUT, PATCH, DELETE)
210-
- Assertions
224+
- Built-in assertions
211225
- JSON parser
212226
- 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
213275

214276

215277

216278
#############################################################
217279

218280
* Performance analysis
281+
- very important part of testing
219282

220283

221284

0 commit comments

Comments
 (0)