-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAutomated_Test
82 lines (59 loc) · 1.7 KB
/
Automated_Test
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
//CREATE USER 🥇
* request url: https://reqres.in/api/users
* requestType: POST
* request body:
{
"name": "Orji",
"job": "Snr QA Engineer"
}
* Assertions:
pm.test("Successful POST request", function () {
pm.expect(pm.response.code).to.be.oneOf([201, 202]);
});
var jsonObject = xml2Json(responseBody);
pm.test("Successful POST request", function () {
pm.expect(pm.response.code).to.be.oneOf([201, 202]);
});
pm.test("Status code name has string", function () {
pm.response.to.have.status("Created");
});
pm.test("Response time is less than 200ms", function () {
pm.expect(pm.response.responseTime).to.be.below(200);
});
//UPDATE USER 🥈
* request url: https://reqres.in/api/users/2
* requestType: PUT
* requestBody:
{
"name": "Orji Innocent",
"job": "QA Engineer"
}
* Assertions
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
pm.test("Body matches string", function () {
pm.expect(pm.response.text()).to.include("Orji Innocent");
});
pm.test("Content-Type is present", function () {
pm.response.to.have.header("Content-Type");
});
pm.test("Successful PUT request", function () {
pm.expect(pm.response.code).to.be.oneOf([200]);
});
pm.test("Status code name has string", function () {
pm.response.to.have.status("updatedAt");
});
// LIST SINGLE USER 🥉
* request url: https://reqres.in/api/users/2
* requestType: GET
* Assertions:
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
pm.test("Body matches string", function () {
pm.expect(pm.response.text()).to.include("email");
});
pm.test("Content-Type is present", function () {
pm.response.to.have.header("Content-Type");
});