Description
In a previous story, we started defining JSON schemas for the ‘page’ endpoints. To validate that our defined schemas match the actual response bodies returned by the endpoint, we need a way to fetch the responses and compare them. This starts with having common methods that will allow us to fetch the JSON schemas, so that we can compare it to the response body that we fetch during testing.
Problem statement
We need a reusable mechanism for fetching responses from both the JSON schemas so that we can compare the php endpoint responses as part of end-to-end testing. The complication of this approach is that all endpoints will have multiple possible responses, based on the associated HTTP status. We therefore need to support pulling responses based on desired status so we can ensure apples to apples comparisons.
- Conditions of acceptance
- Create a code snippet that can pull the desired JSON response from the repo. Input parameters should include, at minimum:
- Endpoint
- Response code (eg: 404, 201)
- If an invalid endpoint and response combination is provided, throw a descriptive error.
- For the initial page endpoints (see: https://phabricator.wikimedia.org/T375530) demonstrate being able to pull both responses for all included HTTP status codes.
- Demonstrate the behavior to the team.
Out of scope
This work does not include response validation across the two sources. Actual validation will be covered in a subsequent ticket.