forked from apiaryio/dredd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ApiaryReportingApi.apib
359 lines (266 loc) · 11.5 KB
/
ApiaryReportingApi.apib
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
FORMAT: 1A
HOST: http://api.apiary.io/
# Apiary Test Reporting API
[Dredd](http://dredd.org/) uses the Test Reporting API to send test reports to
Apiary using the [Apiary Reporter](http://dredd.org/en/latest/how-to-guides.html#using-apiary-reporter-and-apiary-tests).
Each **test report** consists of two logical entities: a **test run** and
one or more **test steps**. The test run is an envelope for the test report
meta data. Each test step represents an individual test within the test report,
i.e. one HTTP transaction Dredd performed and validated
with [Gavel](https://github.com/apiaryio/gavel.js).
## Group Test Reports Bound to an API Project
### Test Runs [/apis/{apiProject}/tests/runs]
+ Parameters
+ apiProject: exampleapi (required) - API project subdomain
#### Create a Test Run [POST]
+ Request (application/json)
+ Headers
Authentication: Token aff888af9993db9ef70edf3c878ab521
+ Attributes (Test Run)
+ Response 201 (application/json; charset=utf-8)
+ Attributes (Saved Test Run)
#### List Test Runs [GET]
+ Request
+ Headers
Authentication: Token aff888af9993db9ef70edf3c878ab521
+ Response 200 (application/json; charset=utf-8)
+ Attributes (array)
+ (Saved Test Run)
### Test Run [/apis/{apiProject}/tests/run/{id}]
+ Parameters
+ apiProject: exampleapi (required) - API project subdomain
+ id: 507f1f77bcf86cd799439011 (required) - unique ID of the test report
#### Retrieve a Test Run [GET]
+ Request
+ Headers
Authentication: Token aff888af9993db9ef70edf3c878ab521
+ Response 200 (application/json; charset=utf-8)
+ Attributes (Saved Test Run)
#### Update Test Run Attributes [PATCH]
+ Request (application/json)
+ Headers
Authentication: Token aff888af9993db9ef70edf3c878ab521
+ Attributes (Test Run Update)
+ endedAt: 1381924299 (number, fixed)
+ status: passed (fixed)
+ result (fixed)
+ tests: 7 (number)
+ failures: 0 (number)
+ passes: 7 (number)
+ Response 200 (application/json; charset=utf-8)
+ Attributes (Saved Test Run)
+ endedAt: 1381924299 (number, fixed)
+ status: passed (fixed)
+ result (fixed)
+ tests: 7 (number)
+ failures: 0 (number)
+ passes: 7 (number)
### Test Steps [/apis/{apiProject}/tests/steps{?testRunId}]
+ Parameters
+ apiProject: exampleapi (required) - API project subdomain
+ testRunId: 507f1f77bcf86cd799439011 (required) - filter by test report ID
#### Create a Test Step [POST]
+ Request (application/json)
+ Headers
Authentication: Token aff888af9993db9ef70edf3c878ab521
+ Attributes (Test Step)
+ Response 201 (application/json; charset=utf-8)
+ Attributes (Saved Test Step)
#### List Test Steps [GET]
+ Request
+ Headers
Authentication: Token aff888af9993db9ef70edf3c878ab521
+ Response 200 (application/json; charset=utf-8)
+ Attributes (array)
+ (Saved Test Step)
### Test Step [/apis/{apiProject}/tests/step/{id}]
#### Retreive a Test Step [GET]
+ Parameters
+ apiProject: exampleapi (required) - API project subdomain
+ id: 508c7f79bcf86cd7994f6c0e (required) - Unique identifier of test step in Apiary
+ Request (application/json)
+ Headers
Authentication: Token aff888af9993db9ef70edf3c878ab521
+ Response 200 (application/json; charset=utf-8)
+ Attributes (Saved Test Step)
## Group Anonymous Test Reports
### Test Runs [/apis/public/tests/runs]
#### Create a Test Run [POST]
+ Request (application/json)
+ Attributes (Test Run)
+ Include Anonymous Test Run
+ Response 201 (application/json; charset=utf-8)
+ Attributes (Saved Test Run)
+ Include Anonymous Test Run
#### List Test Runs [GET]
+ Response 404 (application/json; charset=utf-8)
+ Attributes
+ error: true (boolean)
+ message: `Listing public test runs is not allowed`
### Test Run [/apis/public/tests/run/{id}]
+ Parameters
+ id: 507f1f77bcf86cd799439011 (required) - unique ID of the test report
#### Retrieve a Test Run [GET]
+ Response 200 (application/json; charset=utf-8)
+ Attributes (Saved Test Run)
+ Include Anonymous Test Run
#### Update Test Run Attributes [PATCH]
+ Request (application/json)
+ Attributes (Test Run Update)
+ Include Anonymous Test Run
+ endedAt: 1381924299 (number, fixed)
+ status: passed (fixed)
+ result (fixed)
+ tests: 7 (number)
+ failures: 0 (number)
+ passes: 7 (number)
+ Response 200 (application/json; charset=utf-8)
+ Attributes (Saved Test Run)
+ Include Anonymous Test Run
+ endedAt: 1381924299 (number, fixed)
+ status: passed (fixed)
+ result (fixed)
+ tests: 7 (number)
+ failures: 0 (number)
+ passes: 7 (number)
### Test Steps [/apis/public/tests/steps{?testRunId}]
+ Parameters
+ testRunId: 507f1f77bcf86cd799439011 (required) - filter by test report ID
#### Create a Test Step [POST]
+ Request (application/json)
+ Attributes (Test Step)
+ Include Anonymous Test Step
+ Response 201 (application/json; charset=utf-8)
+ Attributes (Saved Test Step)
+ Include Anonymous Test Step
#### List Test Steps [GET]
+ Response 200 (application/json; charset=utf-8)
+ Attributes (array)
+ (Saved Test Step)
+ Include Anonymous Test Step
### Test Step [/apis/public/tests/step/{id}]
#### Retreive a Test Step [GET]
+ Parameters
+ id: 508c7f79bcf86cd7994f6c0e (required) - Unique identifier of test step in Apiary
+ Response 200 (application/json; charset=utf-8)
+ Attributes (Saved Test Step)
+ Include Anonymous Test Step
## Data Structures
### Test Run
+ endpoint: `http://localhost:3000` (required) - protocol with hostname and optional PORT in URL format, root for all transactions in this Test Run
+ blueprints (array, required) - blueprints used for the test run
+ (object)
+ filename (required) - file name
+ raw (required) - raw API description
+ annotations (array, required) - annotations (errors and warnings) which occurred during parsing or testing
+ (object)
+ type (enum) - type of the annotation.
+ error
+ warning
+ component (enum) - in which component of the compilation process the annotation occurred.
+ apiDescriptionParser
+ parametersValidation
+ uriTemplateExpansion
+ code (number) - parser-specific code of the annotation.
+ message - textual annotation. This is – in most cases – a human-readable message to be displayed to user.
+ location (array) - locations of the annotation in the source file. A series of character-blocks, which may be non-continuous. For further details refer to API Elements' [Source Map](source-map) element.
+ (array, fixed) - continuous characters block. A pair of character index and character count.
+ (number) - zero-based index of a character in the source document.
+ (number) - count of characters starting from the character index.
+ origin - object of references to nodes of [API Elements][api-elements] derived from the original API description document.
+ filename: `./blueprint.md`
+ apiName: `My Api`
+ resourceGroupName: `Greetings`
+ resourceName: `Hello, world!`
+ actionName: `Retrieve Message`
+ exampleName: `First example`
+ public: false (boolean, fixed) - true if the test report is public (anonymous)
+ anonymous: false (boolean, fixed) - true if the test report is public (anonymous)
+ logs (array) - logs from hooks
+ agent: `Dredd/0.1.7 (Linux 3.2.0-23-generic; x64)` - [user agent](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent) performing the test
+ agentRunUuid: 03b3de07-d354-4ba6-aa2e-28789b03c619 - UUID v4 generated by the user agent for test report identification
+ agentEnvironment (optional) - data about user agent's environment (CI, development, staging, production, etc.)
+ CI: true (optional)
+ hostname: machine.fqdn.tld - hostname of computer where test run was preformed, FQDN not necessary
+ startedAt (number) - unix timestamp when the test report started, in UTC
+ createdAt (string) - date in ISO format
+ Include Test Run Update
### Test Run Update
+ logs (array)
+ (object)
+ timestamp: 1381924294 (number) - unix timestamp
+ content: log message from hooks
+ endedAt (number) - unix timestamp when the test report ended, in UTC
+ status (enum) - test report result
+ running
+ failed
+ passed
+ result - test report stats
+ tests: 7 (number)
+ failures: 0 (number)
+ passes: 7 (number)
### Saved Test Run (Test Run)
+ _id: 507f1f77bcf86cd799439011 - unique object ID
+ testRunId: 507f1f77bcf86cd799439011 - unique object ID
+ reportUrl: `https://apiary.io/foo/bar/id` (required) - test reporting page URL
### Anonymous Test Run
+ public: true (boolean, fixed)
+ anonymous: true (boolean, fixed)
### Test Step
+ testRunId: 507f1f77bcf86cd799439011 - reference to the parent test run identificator
+ origin - origin path (position, location) of the step in the blueprint AST
+ filename: ./apiary.apib - file name of original blueprint
+ resourceGroupName: Machines - group name
+ resourceName: Machines Collection - resource name
+ actionName: Create a Machine - action name
+ exampleName: Example 1 - example name
+ duration: 12.345 (number) - test duration in seconds
+ result (enum) - result of step execution
+ skip
+ pass
+ fail
+ results - data from step execution
+ request (HTTP Request) - input to [Gavel](https://github.com/apiaryio/gavel.js)
+ actualResponse (Actual HTTP Response) - input to [Gavel](https://github.com/apiaryio/gavel.js)
+ expectedResponse (Expected HTTP Response) - input to [Gavel](https://github.com/apiaryio/gavel.js)
+ validationResult (Validation Result) - [Gavel](https://github.com/apiaryio/gavel.js) output
+ errors (array) - errors related to the testing itself
+ (object)
+ message - error message
+ stepType: exampleTransaction - type of the step, should be HTTP or Cucumber for instance
+ anonymous: false (boolean, fixed) - true if the test report is public (anonymous)
### Saved Test Step (Test Step)
+ _id: 507c7f79bcf86cd7994f6c0e - unique object ID
### Anonymous Test Step
+ anonymous: true (boolean, fixed)
### Validation Result
+ valid: true (boolean)
+ fields
+ *statusCode*
+ valid: true (boolean)
+ kind: text (enum, nullable)
+ text
+ json
+ values
+ expected: 200 (enum[string, object, number])
+ actual: 200 (enum[string, object, number])
+ errors (array)
+ (object)
+ message: Missing property '/prop'
+ location
+ pointer: /prop
+ property (array)
+ prop
### HTTP Request
+ uri: /
+ method: GET
+ headers
+ *content-type*: application/json
+ body: `{\"message\": \"Hello World!\"}`
### Actual HTTP Response
+ statusCode: 200 (string)
+ headers
+ *content-type*: application/json
+ body: `{\"message\": \"Hello World!\"}`
### Expected HTTP Response (Actual HTTP Response)
+ bodySchema (string)