Debian Codegraph @

testing/web-platform/tests/tools/wave/docs/rest-api/results-api/create.md

raw
1 # `create` - [Results API](../README.md#results-api)
2
3 The `create` method of the results API creates a test result for a given test of a test session.
4
5 ## HTTP Request
6
7 `POST /api/results/<session_token>`
8
9 ## Request Payload
10
11 ```json
12 {
13 "test": "String",
14 "status": "Enum['OK', 'ERROR', 'TIMEOUT', 'NOT_RUN']",
15 "message": "String",
16 "subtests": [
17 {
18 "name": "String",
19 "status": "Enum['PASS', 'FAIL', 'TIMEOUT', 'NOT_RUN']",
20 "message": "String"
21 }
22 ]
23 }
24 ```
25
26 - **test** specifies the test to create the result for.
27 - **status** specifies the overall status of the test. It does not represent a result, but rather if the contained tests were executed as intended or if something went wrong running the test.
28 - **OK**: All tests were executed without problems.
29 - **ERROR**: There was an error running one or multiple tests.
30 - **TIMEOUT**: It took too long for the tests to execute.
31 - **NOT_RUN**: This test was skipped.
32 - **message** contains the reason for the overall status. If the status is `OK` the message should be `null`.
33 - **subtests** contains the actual results of the tests executed in this file.
34 - **name**: The name of the test.
35 - **status**: The status of the result:
36 - **PASS**: The test was executed successfully.
37 - **FAIL**: The test did not meet at least one assertion.
38 - **TIMEOUT**: It took too long for this test to execute.
39 - **NOT_RUN**: This test was skipped.
40 - **message** contains the reason for the tests failure.
41
42 ## Example
43
44 **Request:**
45
46 `POST /api/results/d89bcc00-c35b-11e9-8bb7-9e3d7595d40c`
47
48 ```json
49 {
50 "test": "/apiOne/test/one.html",
51 "status": "OK",
52 "message": null,
53 "subtests": [
54 {
55 "name": "Value should be X",
56 "status": "FAIL",
57 "message": "Expected value to be X but got Y"
58 }
59 ]
60 }
61 ```
62
63 **Response:**
64
65 `200 OK`