Skip to content

Latest commit

 

History

History
362 lines (258 loc) · 13.1 KB

project_tests.rst

File metadata and controls

362 lines (258 loc) · 13.1 KB

Project Tests

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

Project API Tests

Project API tests assert the correct configuration of project-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

Project API Test Cases

Get Test Project

  • Route: /projects/<id>
  • Description: Requests test project by its id. Expects the returned project to match the Project json schema.
  • Rationale: Asserts that the /projects/<id> endpoint returns one valid project object, with id matching the request.
  • Request:
GET /projects/9c0eba51095d3939437e220db196e27b
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": "9c0eba51095d3939437e220db196e27b",
   "version": "1.0",
   "name": "RNAgetTestProject0",
   "description": "Test project object used by RNAget compliance testing suite."
}
  • Success Criteria: Status Code == 200 AND response body is valid Project json
  • Failure Criteria: Status Code != 200 OR response body is NOT valid Project json

Project Not Found

  • Route: /projects/<id>
  • Description: Requests a project with an invalid id, that is, an id that does not correspond to any Project 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 /projects/<id> endpoint does not return arbitrary Project objects, and only returns a Project when the id matches.
  • Request:
GET /projects/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

Project Filters

  • Route: /projects/filters
  • Description: Requests the filters that can be used to narrow search results for a list of Projects
  • Rationale: Asserts that the endpoint returns an array of Filter objects
  • Request:
GET /projects/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",
      "RNAgetTestProject0"
    ],
    "filter": "name",
    "description": "name of project"
  }
]
  • 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 Projects Without Filters

  • Route: /projects
  • Description: Searches for all projects, without specifying any filtering parameters. Expects an array of Projects in the response body.
  • Rationale: Asserts that /projects returns an array, and that each element in the array is a Project.
  • Request:
GET /projects
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": "9c0eba51095d3939437e220db196e27b",
    "version": "1.0",
    "name": "RNAgetTestProject0",
    "description": "Test project object used by RNAget compliance testing suite."
  },
  {
    "description": "Pan Cancer Analysis of Whole Genomes test data from Expression Atlas E-MTAB-5423",
    "id": "43378a5d48364f9d8cf3c3d5104df560",
    "name": "PCAWG",
    "version": "1.0"
  }
]
  • Success Criteria: Status Code == 200 AND response body is array of Project json AND Array Length >= 1
  • Failure Criteria: Status Code != 200 OR response body is NOT array of Project json OR Array Length < 1

Search Projects With All Filters

  • Route: /projects
  • Description: Searches projects, using all filtering parameters associated with test project. Expects an array of Projects to be returned in the response body. Array must contain at least 1 object.
  • Rationale: Asserts that /projects returns an array of Projects even when specifying filters. The returned array MUST have at least 1 object, as the parameter filters must match the attributes of the test project.
  • Request:
GET /projects?version=1.0&name=RNAgetTestProject0
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": "9c0eba51095d3939437e220db196e27b",
    "version": "1.0",
    "name": "RNAgetTestProject0",
    "description": "Test project object used by RNAget compliance testing suite."
  }
]
  • Success Criteria: Status Code == 200 AND response body is array of Project json AND Array Length >= 1
  • Failure Criteria: Status Code != 200 OR response body is NOT array of Project json OR Array Length < 1

Search Projects With Single Filter, 1

  • Route: /projects
  • Description: Searches projects using only 1 filtering parameter associated with test project. Expects an array of Projects, with length of 1 or greater.
  • Rationale: Asserts filtering parameters can be used independently of one another, and that each filter yields the test Project in the search results.
  • Requests:
GET /projects?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": "9c0eba51095d3939437e220db196e27b",
    "version": "1.0",
    "name": "RNAgetTestProject0",
    "description": "Test project object used by RNAget compliance testing suite."
  }
]
  • Success Criteria: Status Code == 200 AND response body is array of Project json AND Array Length >= 1
  • Failure Criteria: Status Code != 200 OR response body is NOT array of Project json OR Array Length < 1

Search Projects With Single Filter, 2

  • Route: /projects
  • Description: Searches projects using only 1 filtering parameter (a different filter than above) associated with test project. Expects an array of Projects, with length of 1 or greater.
  • Rationale: Asserts filtering parameters can be used independently of one another, and that each filter yields the test Project in the search results.
  • Requests:
GET /projects?name=RNAgetTestProject0
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": "9c0eba51095d3939437e220db196e27b",
    "version": "1.0",
    "name": "RNAgetTestProject0",
    "description": "Test project object used by RNAget compliance testing suite."
  }
]
  • Success Criteria: Status Code == 200 AND response body is array of Project json AND Array Length >= 1
  • Failure Criteria: Status Code != 200 OR response body is NOT array of Project json OR Array Length < 1

Project Search Filters Non-Matching Resources

  • Route: /projects
  • Description: Tests that the project search endpoint correctly filters out non-matching Projects based on url parameters. Makes a request to the /projects endpoint with invalid filters (not matching any Project), 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 Projects that differ from filters.
  • Request:
GET /projects?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

Project API Non-Implemented Test Cases

Project Get Not Implemented

  • Route: /projects/<id>
  • Description: If the Projects endpoint is specified as Not Implemented in the config file, then this test will be run. Requests the /projects/<id> endpoint, expecting a 501 Not Implemented status code response
  • Rationale: Asserts that Project related endpoints are correctly non-implemented according to the spec
  • Request:
GET /projects/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

Project Search Not Implemented

  • Route: /projects
  • Description: If the Projects endpoint is specified as Not Implemented in the config file, then this test will be run. Requests the /projects endpoint, expecting a 501 Not Implemented status code response
  • Rationale: Asserts that Project related endpoints are correctly non-implemented according to the spec
  • Request:
GET /projects
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

Project Filters Not Implemented

  • Route: /projects/filters
  • Description: If the Projects endpoint is specified as Not Implemented in the config file, then this test will be run. Requests the /projects/filters endpoint, expecting a 501 Not Implemented status code response
  • Rationale: Asserts that Project related endpoints are correctly non-implemented according to the spec
  • Request:
GET /projects/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