Study Tests

This page outlines the success and failure criteria for all tests of Study resources.

Study API Tests

Study API tests assert the correct configuration of study-related API routes. In order for a test case to succeed, the following conditions must be met when evaluating the response:

  • For all cases, Content-Type checking is enforced. The response MUST have a Content-Type header of application/vnd.ga4gh.rnaget.v1.0.0+json OR application/json

  • For all cases, Status Code checking is enforced. The response MUST have the expected status code

  • For all cases, schema checking is enforced. The json object in the response body MUST conform to a pre-defined schema of required fields and data types, which is specific to each API route

Study API Test Cases

Get Test Study

  • Route: /studies/<id>

  • Description: Requests test study by its id. Expects the returned study to match the Study json schema.

  • Rationale: Asserts that the /studies/<id> endpoint returns one valid study object, with id matching the request.

  • Request:

GET /studies/f3ba0b59bed0fa2f1030e7cb508324d1
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
  • Successful Response:

HTTP/1.1 200 OK
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json

{
  "id": "f3ba0b59bed0fa2f1030e7cb508324d1",
  "version": "1.0",
  "name": "RNAgetTestStudy0",
  "description": "Test study object used by RNAget compliance testing suite.",
  "parentProjectID": "9c0eba51095d3939437e220db196e27b"
}
  • Success Criteria: Status Code == 200 AND response body is valid Study json

  • Failure Criteria: Status Code != 200 OR response body is NOT valid Study json

Study Not Found

  • Route: /studies/<id>

  • Description: Requests a study with an invalid id, that is, an id that does not correspond to any Study on the server. Expects a 404 Not Found status code in the response, and a response body with a message explaining that the specified resource could not be found.

  • Rationale: Asserts that the /studies/<id> endpoint does not return arbitrary Study objects, and only returns a Study when the id matches.

  • Request:

GET /studies/nonexistentid9999999999999999999
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
  • Successful Response:

HTTP/1.1 404 Not Found
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json

{
  "message": "Entry not found in database."
}
  • Success Criteria: Status Code == 404 AND response body is valid Error json

  • Failure Criteria: Status Code != 404 OR response body is NOT valid Error json

Study Filters

  • Route: /studies/filters

  • Description: Requests the filters that can be used to narrow search results for a list of Studies

  • Rationale: Asserts that the endpoint returns an array of filter objects

  • Request:

GET /studies/filters
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
  • Successful Response:

HTTP/1.1 200 OK
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json

[
  {
    "fieldType": "string",
    "values": [
      "1.0"
    ],
    "filter": "version",
    "description": "version to search for"
  },
  {
    "fieldType": "string",
    "values": [
      "PCAWG",
      "RNAGetTestStudy0"
    ],
    "filter": "name",
    "description": "name of study"
  }
]
  • Success Criteria: Status Code == 200 AND response body is array of filters

  • Failure Criteria: Status Code != 200 OR response body is NOT array of filters

Search Studies Without Filters

  • Route: /studies

  • Description: Searches for all studies, without specifying any filtering parameters. Expects an array of Studies in the response body.

  • Rationale: Asserts that the /studies returns an array, and that each element in the array is a Study.

  • Request:

GET /studies
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
  • Successful Response:

HTTP/1.1 200 OK
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json

[
  {
    "id": "6cccbbd76b9c4837bd7342dd616d0fec",
    "parentProjectID": "43378a5d48364f9d8cf3c3d5104df560",
    "name": "PCAWG",
    "description": "PCAWG study",
    "version": "1.0"
  },
  {
    "id": "f3ba0b59bed0fa2f1030e7cb508324d1",
    "parentProjectID": "9c0eba51095d3939437e220db196e27b",
    "name": "RNAgetTestStudy0",
    "description": "Test study object used by RNAget compliance testing suite.",
    "version": "1.0"
  }
]
  • Success Criteria: Status Code == 200 AND response body is array of Study json AND Array Length >= 1

  • Failure Criteria: Status Code != 200 OR response body is NOT array of Study json OR Array Length < 1

Search Studies With All Filters

  • Route: /studies

  • Description: Searches studies, using all filtering parameters associated with test study. Expects an array of Studies to be returned in the response body. Array must contain at least 1 object.

  • Rationale: Asserts that /studies returns an array of Studies even when specifying filters. The returned array MUST have at least 1 object, as the parameter filters must match the attributes of the test study.

  • Request:

GET /studies?version=1.0&name=RNAgetTestStudy0
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
  • Successful Response:

HTTP/1.1 200 OK
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json

[
  {
    "id": "f3ba0b59bed0fa2f1030e7cb508324d1",
    "parentProjectID": "9c0eba51095d3939437e220db196e27b",
    "name": "RNAgetTestStudy0",
    "description": "Test study object used by RNAget compliance testing suite.",
    "version": "1.0"
  }
]
  • Success Criteria: Status Code == 200 AND response body is array of Study json AND Array Length >= 1

  • Failure Criteria: Status Code != 200 OR response body is NOT array of Study json OR Array Length < 1

Search Studies With Single Filter, 1

  • Route: /studies

  • Description: Searches studies using only 1 filtering parameter associated with test study. Expects an array of Studies, with length of 1 or greater.

  • Rationale: Asserts filtering parameters can be used independently of one another, and that each filter yields the test Study in the search results.

  • Requests:

GET /studies?version=1.0
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
  • Successful Response:

HTTP/1.1 200 OK
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json

[
  {
    "id": "f3ba0b59bed0fa2f1030e7cb508324d1",
    "parentProjectID": "9c0eba51095d3939437e220db196e27b",
    "name": "RNAgetTestStudy0",
    "description": "Test study object used by RNAget compliance testing suite.",
    "version": "1.0"
  }
]
  • Success Criteria: Status Code == 200 AND response body is array of Study json AND Array Length >= 1

  • Failure Criteria: Status Code != 200 OR response body is NOT array of Study json OR Array Length < 1

Search Studies With Single Filter, 2

  • Route: /studies

  • Description: Searches studies using only 1 filtering parameter (a different filter than above) associated with test study. Expects an array of Studies, with length of 1 or greater.

  • Rationale: Asserts filtering parameters can be used independently of one another, and that each filter yields the test Study in the search results.

  • Requests:

GET /studies?name=RNAgetTestStudy0
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
  • Successful Response:

HTTP/1.1 200 OK
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json

[
  {
    "id": "f3ba0b59bed0fa2f1030e7cb508324d1",
    "parentProjectID": "9c0eba51095d3939437e220db196e27b",
    "name": "RNAgetTestStudy0",
    "description": "Test study object used by RNAget compliance testing suite.",
    "version": "1.0"
  }
]
  • Success Criteria: Status Code == 200 AND response body is array of Study json AND Array Length >= 1

  • Failure Criteria: Status Code != 200 OR response body is NOT array of Study json OR Array Length < 1

Study Search Filters Non-Matching Resources

  • Route: /studies

  • Description: Tests that the study search endpoint correctly filters out non-matching Studies based on url parameters. Makes a request to the /studies endpoint with invalid filters (not matching any Study), and expects an empty array as a response.

  • Rationale: Asserts that the endpoint correctly filters out non-matching entities, that the endpoint does not return an arbitrary list of Studies that differ from filters.

  • Request:

GET /studies?version=nonexistentid9999999999999999999&name=nonexistentid9999999999999999999
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
  • Successful Response:

HTTP/1.1 200 OK
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json

[]
  • Success Criteria: Status Code == 200 AND response body is an empty array

  • Failure Criteria: Status Code != 200 OR response body is NOT an empty array

Study API Non-Implemented Test Cases

Study Get Not Implemented

  • Route: /studies/<id>

  • Description: If the Studies endpoint is specified as Not Implemented in the config file, then this test will be run. Requests the /studies/<id> endpoint, expecting a 501 Not Implemented status code response

  • Rationale: Asserts that Study related endpoints are correctly non-implemented according to the spec

  • Request:

GET /studies/nonexistentid9999999999999999999
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
  • Successful Response:

HTTP/1.1 501 Not Implemented
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
  • Success Criteria: Status Code == 501

  • Failure Criteria: Status Code != 501

Study Search Not Implemented

  • Route: /studies

  • Description: If the Studies endpoint is specified as Not Implemented in the config file, then this test will be run. Requests the /studies endpoint, expecting a 501 Not Implemented status code response

  • Rationale: Asserts that Study related endpoints are correctly non-implemented according to the spec

  • Request:

GET /studies
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
  • Successful Response:

HTTP/1.1 501 Not Implemented
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
  • Success Criteria: Status Code == 501

  • Failure Criteria: Status Code != 501

Study Search Filters Not Implemented

  • Route: /studies/filters

  • Description: If the Studies endpoint is specified as Not Implemented in the config file, then this test will be run. Requests the /studies/filters endpoint, expecting a 501 Not Implemented status code response

  • Rationale: Asserts that Study related endpoints are correctly non-implemented according to the spec

  • Request:

GET /studies/filters
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
  • Successful Response:

HTTP/1.1 501 Not Implemented
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
  • Success Criteria: Status Code == 501

  • Failure Criteria: Status Code != 501