case

More info about the test case schema can be found here.

Note

This resource can also be accessed using the plural form cases.

GET

GET /test/case/(string: id)/

Get all the available test cases or a single one if id is provided.

Parameters:
  • id (string) – The ID of the test case to retrieve.
Request Headers:
 
Response Headers:
 
Query Parameters:
 
  • limit (int) – Number of results to return. Default 0 (all results).
  • skip (int) – Number of results to skip. Default 0 (none).
  • sort (string) – Field to sort the results on. Can be repeated multiple times.
  • sort_order (int) – The sort order of the results: -1 (descending), 1 (ascending). This will be applied only to the first sort parameter passed. Default -1.
  • date_range (int) – Number of days to consider, starting from today (more info). By default consider all results.
  • field (string) – The field that should be returned in the response. Can be repeated multiple times.
  • nfield (string) – The field that should not be returned in the response. Can be repeated multiple times.
  • _id (string) – The internal ID of the test case report.
  • created_on (string) – The creation date: accepted formats are YYYY-MM-DD and YYYYMMDD.
  • kvm_guest (string) – The name of the KVM guest the test was executed on.
  • maximum (int) – The maximum measurement registered.
  • minimum (int) – The minimum measurement registered.
  • name (string) – The name of a test case.
  • samples (int) – Number of registered measurements.
  • status (string) – The status of the test execution.
  • test_suite_id (string) – The ID of the test suite associated with the test case.
  • test_suite_name (string) – The name of the test suite associated with the test case.
  • time (string) – The time it took to execute the test case.
  • vcs_commit (string) – The VCS commit value.
Status Codes:

Example Requests

GET /test/case HTTP/1.1
Host: api.kernelci.org
Accept: */*
Authorization: token
GET /tests/cases HTTP/1.1
Host: api.kernelci.org
Accept: */*
Authorization: token

Example Responses

HTTP/1.1 200 OK
Vary: Accept-Encoding
Date: Mon, 16 Mar 2015 14:03:19 GMT
Content-Type: application/json; charset=UTF-8

{
    "code": 200,
    "count": 1,
    "result": [
        {
            "_id": {
                "$oid": "123456789",
                "name": "Test case 0"
            }
        }
    ]
}

Note

Results shown here do not include the full JSON response.

POST

POST /test/case

Create a new test case as defined in the JSON data. The request will be accepted and parsed.

If saving the test case has success, it will return the associated ID value.

For more info on all the required JSON request fields, see the test case schema for POST requests.

Request JSON Object:
 
  • name (string) – The name of the test case.
  • test_suite_id (string) – The ID of the test suite the test case belongs to.
  • version (string) – The version of the JSON schema format.
Request Headers:
 
Response Headers:
 
Status Codes:

Example Requests

POST /test/case HTTP/1.1
Host: api.kernelci.org
Content-Type: application/json
Accept: */*
Authorization: token

{
    "name": "A test case",
    "test_suite_id": "01234567890123456789ABCD",
    "version": "1.0"
}
POST /test/case HTTP/1.1
Host: api.kernelci.org
Content-Type: application/json
Accept: */*
Authorization: token

{
    "name": "A test case",
    "test_suite_id": "01234567890123456789ABCD",
    "version": "1.0"
}

Example Responses

HTTP/1.1 201 Test case 'A test case' created
Vary: Accept-Encoding
Date: Mon, 16 Mar 2014 12:29:51 GMT
Content-Type: application/json; charset=UTF-8
Location: /test/case/01234567890123456789ABCD

{
    "code": 201,
    "result": [
        {
            "_id": {
                "$oid": "01234567890123456789ABCD"
            }
        }
    ],
    "reason": "Test case 'A test case' created"
}

PUT

PUT /test/case/(string: id)/

Update an existing test case identified by its id with values defined in the JSON data.

Parameters:
  • id (string) – The ID of the test case.
Request Headers:
 
Response Headers:
 
Status Codes:

Example Requests

POST /test/case/01234567890123456789ABCD HTTP/1.1
Host: api.kernelci.org
Content-Type: application/json
Accept: */*
Authorization: token

{
    "name": "The new name"
}

Example Responses

HTTP/1.1 202 Resource '01234567890123456789ABCD' updated
Vary: Accept-Encoding
Date: Mon, 16 Mar 2014 12:29:51 GMT
Content-Type: application/json; charcase=UTF-8

{
    "code": 200,
    "reason": "Resource '01234567890123456789ABCD' updated",
}

DELETE

DELETE /test/case/(string: id)/

Delete the test case identified by id.

Parameters:
  • id (string) – The ID of the test case.
Request Headers:
 
Response Headers:
 
Status Codes:

Example Requests

DELETE /test/case/01234567890123456789ABCD/ HTTP/1.1
Host: api.kernelci.org
Accept: */*
Content-Type: application/json
Authorization: token

Example Responses

HTTP/1.1 202 Resource '01234567890123456789ABCD' deleted
Vary: Accept-Encoding
Date: Mon, 16 Mar 2014 12:29:51 GMT
Content-Type: application/json; charset=UTF-8

{
    "code": 200,
    "reason": "Resource '01234567890123456789ABCD' deleted",
}