Last active
August 29, 2015 13:55
-
-
Save kevinswiber/8696975 to your computer and use it in GitHub Desktop.
Exploring hypermedia aware acceptance testing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Root Resource | |
As an API client | |
I want to see the root resource | |
So that I have a starting point to complete my task. | |
Scenario: Request the root | |
Given an anonymous client | |
When I make a GET request to / | |
Then I should get a 200 status code | |
And the content type should be JSON | |
Scenario: Request the hypermedia root | |
Given an anonymous client | |
When I make a request to the root URI | |
Then the request should succeed | |
And the response media type should be Siren | |
And the response should include a self link |
Sorry for this bothering theme: but what about "ignore" hypermedia and step away from HTTP like so:
Scenario: Request the API root
Given an anonymous client
When I make a request to the API root
Then the request should succeed
And the response media type should be Siren
And the response should include a self link
Certainly. The only reason I made the distinction of "hypermedia" in the scenario is because I'm actually executing the specifications and needed a way to distinguish between the two. :)
This is still riddled with technical details that are irrelevant to the domain. Of course, I have a lot more experience writing automated acceptance tests for domain logic, not APIs. When the reader happens to be a developer, perhaps this is perfectly acceptable. Thoughts?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The "Request the root" scenario is something you might find in a non-hypermedia test. The "Request the hypermedia root" scenario is my first stab at making it hypermedia-ish.