Skip to content

Instantly share code, notes, and snippets.

@TheMightyLlama
Created November 1, 2019 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheMightyLlama/68bb1e3f7234f509a15d1e1209385bc7 to your computer and use it in GitHub Desktop.
Save TheMightyLlama/68bb1e3f7234f509a15d1e1209385bc7 to your computer and use it in GitHub Desktop.
API BDD
Feature: A Client can GET a SECTOR resource
As a Client
I want to get a sector
So that I can evaluate what needs to be modified
Background:
Given the system knows about the following sector:
| sector id | sector name | sector url |
| 1 | Oil & Gas | http://www.iii.co.uk/investment/detail?code=cotn:NMX0530.L&display=sector |
And the client creates a new SECTOR request
Scenario Outline: SECTOR: GET SECTOR - SUCCESS
And the request has the content type: <content type>
And the request has the sector id: <sector id>
When the client executes the GET RESOURCE request
Then the response status is: <status>
And the response has the jsonapi version
And the response has the sector id: <sector id>
And the response has the sector name: <sector name>
And the response has the sector url: <sector url>
Examples:
| content type | sector id | sector name | sector url | status |
|"application/vnd.api+json"| "1" | "Oil & Gas" | "http://www.iii.co.uk/investment/detail?code=cotn:NMX0530.L&display=sector" | "SUCCESS" |
Scenario Outline: SECTOR: GET RESOURCE - UNSUCCESSFUL - RESOURCE DOES NOT EXIST
And the request has the content type: <content type>
And the request has the sector id: <id>
When the client executes the GET RESOURCE request
Then the response status is: <status>
And the response has the jsonapi version
And the response message matches: <message>
Examples:
| content type | id | status | message |
|"application/vnd.api+json"| "2" | "ERROR" | "Resource does not exist" |
|"application/vnd.api+json"| "3" | "ERROR" | "Resource does not exist" |
|"application/vnd.api+json"| "4" | "ERROR" | "Resource does not exist" |
Scenario Outline: SECTOR: GET RESOURCE - UNSUCCESSFUL - UNSUPPORTED MEDIA TYPE
And the request has the content type: <content type>
And the request has the sector id: <id>
When the client executes the GET RESOURCE request
Then the response status is: <status>
And the response has the jsonapi version
And the response message matches: <message>
Examples:
| content type |id | status | message |
| "application/vnd.hzn-3d-crossword" | "1" | "ERROR" | "Unsupported media type. Content Type: application/vnd.api+json required." |
| "video/3gpp" | "1" | "ERROR" | "Unsupported media type. Content Type: application/vnd.api+json required." |
| "application/x-7z-compressed" | "1" | "ERROR" | "Unsupported media type. Content Type: application/vnd.api+json required." |
| "application/x-abiword" | "1" | "ERROR" | "Unsupported media type. Content Type: application/vnd.api+json required." |
| "application/x-ace-compressed" | "1" | "ERROR" | "Unsupported media type. Content Type: application/vnd.api+json required." |
| "application/vnd.americandynamics.acc" | "1" | "ERROR" | "Unsupported media type. Content Type: application/vnd.api+json required." |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment