-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcollection.json
More file actions
802 lines (802 loc) · 20.4 KB
/
collection.json
File metadata and controls
802 lines (802 loc) · 20.4 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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
{
"info": {
"_postman_id": "b34b7a28-42d6-44e2-9571-9ae4e6038b62",
"name": "ATD 2018 USA",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "1 - Getting our feet wet",
"description": "",
"item": [
{
"name": "Get weather from the Dark Sky API",
"event": [
{
"listen": "test",
"script": {
"id": "0426bcd9-ce79-4df2-9657-bebf60804b8a",
"type": "text/javascript",
"exec": [
"pm.test(\"Request with valid lat and long returns a 200 status code\", function () {",
" pm.response.to.have.status(200);",
"});"
]
}
}
],
"request": {
"method": "GET",
"header": [],
"body": {},
"url": {
"raw": "https://api.darksky.net/forecast/219a4cc6ef64023fdcee03a7335372b9/{{latitude}},{{longitude}}",
"protocol": "https",
"host": [
"api",
"darksky",
"net"
],
"path": [
"forecast",
"219a4cc6ef64023fdcee03a7335372b9",
"{{latitude}},{{longitude}}"
]
}
},
"response": []
}
]
},
{
"name": "2 - Fundamental - Exploratory Tests",
"description": "**5 minutes**\r\n\r\nExploratory testing approach\r\n- Identify the variable parts (we'll write these on a flip chart).\r\n- Apply Heuristics to the variables (not all of these may be applicable to our example)\r\n-- Zero, One, Many\r\n-- Some, None, All\r\n-- Beginning, Middle, End\r\n-- Too Many, Too Few\r\n-- Relative Position, i.e. content",
"item": [
{
"name": "Exploratory Testing the Weather API - Equator at Prime Meridian",
"request": {
"auth": {
"type": "noauth"
},
"method": "GET",
"header": [],
"body": {},
"url": {
"raw": "https://api.darksky.net/forecast/{{darkskyKey}}/0,0",
"protocol": "https",
"host": [
"api",
"darksky",
"net"
],
"path": [
"forecast",
"{{darkskyKey}}",
"0,0"
]
}
},
"response": []
},
{
"name": "Exploratory Testing the Weather API - 100,100",
"request": {
"method": "GET",
"header": [],
"body": {},
"url": {
"raw": "https://api.darksky.net/forecast/{{darkskyKey}}/100,100",
"protocol": "https",
"host": [
"api",
"darksky",
"net"
],
"path": [
"forecast",
"{{darkskyKey}}",
"100,100"
]
}
},
"response": []
},
{
"name": "Exploratory Testing the Weather API - South Pole",
"request": {
"method": "GET",
"header": [],
"body": {},
"url": {
"raw": "https://api.darksky.net/forecast/{{darkskyKey}}/-90,0",
"protocol": "https",
"host": [
"api",
"darksky",
"net"
],
"path": [
"forecast",
"{{darkskyKey}}",
"-90,0"
]
}
},
"response": []
},
{
"name": "Exploratory Testing the Weather API - North Pole",
"request": {
"method": "GET",
"header": [],
"body": {},
"url": {
"raw": "https://api.darksky.net/forecast/{{darkskyKey}}/90,0",
"protocol": "https",
"host": [
"api",
"darksky",
"net"
],
"path": [
"forecast",
"{{darkskyKey}}",
"90,0"
]
}
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"id": "2d66424f-1d29-46b6-ade6-76227492b395",
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"id": "b5233ac5-661b-4478-bb2b-d4512cf6f8be",
"type": "text/javascript",
"exec": [
""
]
}
}
]
},
{
"name": "3 - Fundamental - Functional Tests (aka Component tests)",
"description": "**10 minutes**\r\n\r\nIn this activity, we'll add an assertion to our GET weather request.\r\n\r\nOpen a new tab.\r\nType or paste your request from 1-GET weather activity.\r\nClick the 'Tests' tab (check out Dan's screen).\r\nFirst we'll add a test for the status code (Dan will talk us through this).\r\nThen we'll check our response to make sure we're getting the weather forecast for our desired location.\r\n",
"item": [
{
"name": "Response codes",
"event": [
{
"listen": "test",
"script": {
"id": "7bcda5fd-d76e-4c2f-a3d9-4df0473532ed",
"type": "text/javascript",
"exec": [
""
]
}
}
],
"request": {
"method": "GET",
"header": [],
"body": {},
"url": {
"raw": "https://api.darksky.net/forecast/{{darkskyKey}}/{{latitude}},{{longitude}}?exclude=minutely,hourly,daily,flags",
"protocol": "https",
"host": [
"api",
"darksky",
"net"
],
"path": [
"forecast",
"{{darkskyKey}}",
"{{latitude}},{{longitude}}"
],
"query": [
{
"key": "exclude",
"value": "minutely,hourly,daily,flags"
}
]
}
},
"response": []
},
{
"name": "Weather on New Years Day 2018",
"event": [
{
"listen": "prerequest",
"script": {
"id": "0a218173-9e24-4126-b91a-4ff6d90434d4",
"type": "text/javascript",
"exec": [
"postman.setGlobalVariable(\"NewYearsDay\", \"2018-01-01T00:00:01\");"
]
}
},
{
"listen": "test",
"script": {
"id": "2ca5abb6-f8f5-47c0-8168-ab35a37c1dc3",
"type": "text/javascript",
"exec": [
"pm.test(\"Forecast matches recorded weather\", function() {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.currently.summary).to.eql(\"Clear\");",
"});"
]
}
}
],
"request": {
"method": "GET",
"header": [],
"body": {},
"url": {
"raw": "https://api.darksky.net/forecast/{{darkskyKey}}/{{latitude}},{{longitude}},{{NewYearsDay}}",
"protocol": "https",
"host": [
"api",
"darksky",
"net"
],
"path": [
"forecast",
"{{darkskyKey}}",
"{{latitude}},{{longitude}},{{NewYearsDay}}"
]
}
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"id": "a934cf78-10c3-4efa-845b-677969f53e76",
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"id": "0b950846-9920-4059-a605-4796f79dcc30",
"type": "text/javascript",
"exec": [
""
]
}
}
]
},
{
"name": "4 - Fundamental - Contract Tests",
"description": "**10 minutes**\r\n\r\nContract tests verify that what you send back in your response matches what you told users would come back in your response.\r\n\r\nOne way of doing this in Postman is throught a schema validation.\r\n\r\nA schema defines the data structure of the response, and the rules around the structure. Rules meaning like what is required, what values can be null, what the max or min length of a string can be, and so on.\r\n\r\nWe have rules around specifying this data structure, or schema, in json, so that we can all understand what is expected.\r\n\r\nPostman has a built-in schema validator that we can use - we just need to specify the schema that we want our response validated against.\r\n\r\njsonschema.net is a sweet tool for doing this.",
"item": [
{
"name": "Response json schema should match expected schema",
"event": [
{
"listen": "test",
"script": {
"id": "6b9b095b-6026-4a1c-98e2-59c7655c92fb",
"type": "text/javascript",
"exec": [
"var data = JSON.parse(responseBody);",
"var schema = {",
" \"$id\": \"http://example.com/example.json\",",
" \"type\": \"object\",",
" \"definitions\": {},",
" \"$schema\": \"http://json-schema.org/draft-07/schema#\",",
" \"additionalProperties\": false,",
" \"properties\": {",
" \"latitude\": {",
" \"$id\": \"/properties/latitude\",",
" \"type\": \"number\"",
" },",
" \"longitude\": {",
" \"$id\": \"/properties/longitude\",",
" \"type\": \"number\"",
" },",
" \"timezone\": {",
" \"$id\": \"/properties/timezone\",",
" \"type\": \"string\"",
" },",
" \"offset\": {",
" \"$id\": \"/properties/offset\",",
" \"type\": \"integer\"",
" }",
" },",
" \"required\": [",
" \"latitude\",",
" \"longitude\",",
" \"timezone\",",
" \"offset\"",
" ]",
"}",
"",
"pm.test(\"Response matches schema\", function () {",
" pm.expect(tv4.validate(data, schema),tv4.error).to.be.true;",
" console.log(\"Schema Validation failed: \", tv4.error);",
"",
" });"
]
}
}
],
"request": {
"method": "GET",
"header": [],
"body": {},
"url": {
"raw": "https://api.darksky.net/forecast/{{darkskyKey}}/{{latitude}},{{longitude}}?exclude=currently,minutely,hourly,daily,flags,alerts",
"protocol": "https",
"host": [
"api",
"darksky",
"net"
],
"path": [
"forecast",
"{{darkskyKey}}",
"{{latitude}},{{longitude}}"
],
"query": [
{
"key": "exclude",
"value": "currently,minutely,hourly,daily,flags,alerts"
}
]
}
},
"response": []
},
{
"name": "Response json schema should match expected schema (change query to exclude flags)",
"event": [
{
"listen": "test",
"script": {
"id": "fbb33ba0-c1ae-4a35-9a62-9749c7128f24",
"type": "text/javascript",
"exec": [
"var data = JSON.parse(responseBody);",
"var schema = {",
" \"$id\": \"http://example.com/example.json\",",
" \"type\": \"object\",",
" \"definitions\": {},",
" \"$schema\": \"http://json-schema.org/draft-07/schema#\",",
" \"additionalProperties\": false,",
" \"properties\": {",
" \"latitude\": {",
" \"$id\": \"/properties/latitude\",",
" \"type\": \"number\"",
" },",
" \"longitude\": {",
" \"$id\": \"/properties/longitude\",",
" \"type\": \"number\"",
" },",
" \"timezone\": {",
" \"$id\": \"/properties/timezone\",",
" \"type\": \"string\"",
" },",
" \"offset\": {",
" \"$id\": \"/properties/offset\",",
" \"type\": \"integer\"",
" }",
" },",
" \"required\": [",
" \"latitude\",",
" \"longitude\",",
" \"timezone\",",
" \"offset\"",
" ]",
"}",
"",
"pm.test(\"Response matches schema\", function () {",
" pm.expect(tv4.validate(data, schema),tv4.error).to.be.true;",
" console.log(\"Schema Validation failed: \", tv4.error);",
"",
" });"
]
}
}
],
"request": {
"method": "GET",
"header": [],
"body": {},
"url": {
"raw": "https://api.darksky.net/forecast/{{darkskyKey}}/{{latitude}},{{longitude}}?exclude=currently,minutely,hourly,daily,alerts",
"protocol": "https",
"host": [
"api",
"darksky",
"net"
],
"path": [
"forecast",
"{{darkskyKey}}",
"{{latitude}},{{longitude}}"
],
"query": [
{
"key": "exclude",
"value": "currently,minutely,hourly,daily,alerts"
}
]
}
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"id": "ed0bb033-08b0-4331-9253-10572e2a2590",
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"id": "f3e701e9-c74b-4964-a42b-1d95cb54061b",
"type": "text/javascript",
"exec": [
""
]
}
}
]
},
{
"name": "5 - Fundamental - Performance, Load & Security Tests",
"description": "**10 minutes**\r\n\r\nWe can easily extract a value from our json response.\r\nLet's add more than an assertion to the post-response javascript code.",
"item": [
{
"name": "Response time should be less than 200 ms",
"event": [
{
"listen": "test",
"script": {
"id": "5b51f9c8-5965-40a7-a352-ad3ed370ea7c",
"type": "text/javascript",
"exec": [
"pm.test(\"Response time is less than 200ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(200);",
"});"
]
}
}
],
"request": {
"method": "GET",
"header": [],
"body": {},
"url": {
"raw": "https://api.darksky.net/forecast/{{darkskyKey}}/{{latitude}},{{longitude}}",
"protocol": "https",
"host": [
"api",
"darksky",
"net"
],
"path": [
"forecast",
"{{darkskyKey}}",
"{{latitude}},{{longitude}}"
]
}
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"id": "757cfab0-f421-40ff-9ce9-aa195d4088d9",
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"id": "ccdfed8d-a3ee-4a39-ad3c-f9f4d398d122",
"type": "text/javascript",
"exec": [
""
]
}
}
]
},
{
"name": "6 - Fundamental - \"EndToEnd\" Tests (aka Integration Tests)",
"description": "",
"item": [
{
"name": "Get lat and long from darksky Geo",
"event": [
{
"listen": "test",
"script": {
"id": "828ec1a8-dac9-4ac7-b1a6-5b61e7780d6e",
"type": "text/javascript",
"exec": [
"var jsonData = pm.response.json();",
"pm.environment.set(\"latitude\", jsonData.latitude);",
"pm.environment.set(\"longitude\", jsonData.longitude);"
]
}
}
],
"request": {
"method": "GET",
"header": [],
"body": {},
"url": {
"raw": "https://darksky.net/geo?q={{location}}",
"protocol": "https",
"host": [
"darksky",
"net"
],
"path": [
"geo"
],
"query": [
{
"key": "q",
"value": "{{location}}"
}
]
}
},
"response": []
},
{
"name": "GET forecast from darksky",
"event": [
{
"listen": "test",
"script": {
"id": "31bd0dd6-ffaa-47e0-a522-47acd0d1d89f",
"type": "text/javascript",
"exec": [
"//extract time",
"var jsonData = pm.response.json();",
"pm.environment.set(\"forecast_time\", jsonData.hourly.data[0].time);",
"pm.environment.set(\"darksky_temp\", jsonData.hourly.data[0].temperature);",
"pm.test(\"Request with valid lat and long returns a 200 status code\", function () {",
" pm.response.to.have.status(200);",
"});"
]
}
}
],
"request": {
"method": "GET",
"header": [],
"body": {},
"url": {
"raw": "https://api.darksky.net/forecast/{{darkskyKey}}/{{latitude}},{{longitude}}?exclude=minutely,currently,daily,flags,alerts",
"protocol": "https",
"host": [
"api",
"darksky",
"net"
],
"path": [
"forecast",
"{{darkskyKey}}",
"{{latitude}},{{longitude}}"
],
"query": [
{
"key": "exclude",
"value": "minutely,currently,daily,flags,alerts"
}
]
}
},
"response": []
},
{
"name": "GET forecast from aeris API",
"event": [
{
"listen": "test",
"script": {
"id": "cad93d58-6e4e-4f5f-b533-d9dda125355d",
"type": "text/javascript",
"exec": [
"var jsonData = pm.response.json();",
"",
"pm.test(\"Darksky latitude for location matches aeris latitude\", function () {",
" pm.expect(jsonData.response[0].loc.lat.toPrecision(2)).to.eql(pm.environment.get(\"latitude\").toPrecision(2));",
"});",
"",
"pm.test(\"Darksky longitude for location matches aeris longitude\", function () {",
" pm.expect(jsonData.response[0].loc.long.toPrecision(2)).to.eql(pm.environment.get(\"longitude\").toPrecision(2));",
"});",
"",
"// pm.test(\"Darksky temp for current time matches aeris temp for same time\", function () {",
"// pm.expect(jsonData.response[0].periods[0].tempF).to.eql(Math.round(pm.environment.get(\"darksky_temp\")));",
"// });",
"console.log(\"Darksky time, lat, long, temp = \" + pm.environment.get(\"forecast_time\") + \",\" + pm.environment.get(\"latitude\") + \",\" + pm.environment.get(\"longitude\")+ \",\" + Math.round(pm.environment.get(\"darksky_temp\")));",
"console.log(\"Aeris time, lat, long, temp = \" + jsonData.response[0].periods[0].timestamp + \",\" + jsonData.response[0].loc.lat + \",\" + jsonData.response[0].loc.long + \",\" + jsonData.response[0].periods[0].tempF);",
""
]
}
}
],
"request": {
"auth": {
"type": "noauth"
},
"method": "GET",
"header": [],
"body": {},
"url": {
"raw": "https://api.aerisapi.com/forecasts/{{location}}?from={{forecast_time}}&filter=1hr&client_id={{aerisID}}&client_secret={{aerisSecret}}",
"protocol": "https",
"host": [
"api",
"aerisapi",
"com"
],
"path": [
"forecasts",
"{{location}}"
],
"query": [
{
"key": "from",
"value": "{{forecast_time}}"
},
{
"key": "filter",
"value": "1hr"
},
{
"key": "client_id",
"value": "{{aerisID}}"
},
{
"key": "client_secret",
"value": "{{aerisSecret}}"
}
]
}
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"id": "10f38ba5-9d50-431e-b144-1a2f376b0c9b",
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"id": "e82cf4bd-d7d5-45a0-bdd8-206b4ecadb0b",
"type": "text/javascript",
"exec": [
""
]
}
}
]
},
{
"name": "7 - Running tests in Postman",
"description": "location.json\n\n[{\n \"location\": \"Boston, MA\"\n }, {\n \"location\": \"Atlanta, GA\"\n }, {\n \"location\": \"Denver, CO\"\n }, {\n \"location\": \"San Diego, CA\"\n}]",
"item": [],
"event": [
{
"listen": "prerequest",
"script": {
"id": "dd1fad99-2aba-4f5e-b57c-b6ac6db91013",
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"id": "41f8913a-b3fe-4653-948d-409fa08466d1",
"type": "text/javascript",
"exec": [
""
]
}
}
]
},
{
"name": "8 - Running tests in CI & Test Reporting",
"description": "",
"item": [],
"event": [
{
"listen": "prerequest",
"script": {
"id": "dd1fad99-2aba-4f5e-b57c-b6ac6db91013",
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"id": "41f8913a-b3fe-4653-948d-409fa08466d1",
"type": "text/javascript",
"exec": [
""
]
}
}
]
}
],
"event": [
{
"listen": "prerequest",
"script": {
"id": "e40f1f39-5b04-4d3e-82f6-f9044f4676f5",
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"id": "4128584d-7354-4ff3-976b-773ae868ade5",
"type": "text/javascript",
"exec": [
""
]
}
}
]
}