-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmock-validation.feature
101 lines (93 loc) · 1.9 KB
/
mock-validation.feature
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
@mock-validation @openapi-file=petstore-openapi.yml
Feature: Mock Validator Test
Background:
* url baseUrl
* def auth = { username: '', password: '' }
* def authHeader = call read('classpath:karate-auth.js') auth
* configure headers = authHeader || {}
# Update an existing pet
@operationId=updatePet
Scenario: validate updatePet mock endpoint
Given def body =
"""
{
"id": 10,
"name": "doggie",
"category": {
"id": 1,
"name": "Dogs"
},
"photoUrls": [
"fill some value"
],
"tags": [
{
"id": 0,
"name": "fill some value"
}
],
"status": "available"
}
"""
Given path '/pet'
And request body
When method PUT
Then status 200
# Add a new pet to the store
@operationId=addPet
Scenario: validate addPet mock endpoint
Given def body =
"""
{
"id": 10,
"name": "doggie",
"category": {
"id": 1,
"name": "Dogs"
},
"photoUrls": [
"fill some value"
],
"tags": [
{
"id": 0,
"name": "fill some value"
}
],
"status": "available"
}
"""
Given path '/pet'
And request body
When method POST
Then status 200
# Finds Pets by status
@operationId=findPetsByStatus
Scenario: validate findPetsByStatus mock endpoint
Given def params = {"status":"sold"}
Given path '/pet/findByStatus'
And param status = params.status
When method GET
Then status 200
# Finds Pets by tags
@operationId=findPetsByTags
Scenario: validate findPetsByTags mock endpoint
Given def params = {"tags": ["tag1"]}
Given path '/pet/findByTags'
And param tags = params.tags
When method GET
Then status 200
# Find pet by ID
@operationId=getPetById
Scenario: validate getPetById mock endpoint
Given def params = {"petId":1}
Given path '/pet/', params.petId
When method GET
Then status 200
# Deletes a pet
@operationId=deletePet
Scenario: validate deletePet mock endpoint
Given def params = {"api_key":"fill some value","petId":0}
Given path '/pet/', params.petId
When method DELETE
Then status 200