This file contains hidden or 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
| [When(@"I retrieve the results")] | |
| public void WhenRetrieveTheResults() | |
| { | |
| try | |
| { | |
| this.content = wc.DownloadString(url); | |
| this.httpStatus = HttpStatusCode.OK; | |
| } | |
| catch (WebException we) | |
| { |
This file contains hidden or 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
| [Then(@"the status code should be (.*)")] | |
| public void ThenTheStatusCodeShouldBe(int statusCode) | |
| { | |
| Assert.AreEqual(statusCode, (int)this.httpStatus); | |
| } |
This file contains hidden or 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
| [Then(@"it should have the field ""(.*)"" containing the value ""(.*)""")] | |
| public void ThenItShouldContainTheFieldContainingTheValue(string field, string value) | |
| { | |
| if (response != null) | |
| { | |
| JValue val = (JValue)this.response.GetValue(field); | |
| string valStr = val.Value().Trim(); | |
| Assert.IsNotNull(valStr); | |
| Assert.AreEqual(valStr, value.Trim()); | |
| } |
This file contains hidden or 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
| [Binding] | |
| public class RestTestSteps | |
| { | |
| private string url; | |
| private string content; | |
| private WebClient wc = new WebClient(); | |
| JObject response; | |
| HttpStatusCode httpStatus; | |
| [Given(@"I access the resource url ""(.*)""")] |
This file contains hidden or 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
| @Positive @Get @User | |
| Scenario: Show twitter user | |
| Given I access the resource url "/1/users/show.json?screen_name=jasonh_n_austin&include_entities=true" | |
| When I retrieve the results | |
| Then the status code should be 200 | |
| And it should have the field "name" containing the value "Jason Harmon" | |
| And it should have the field "id" containing the value "57005215" |
This file contains hidden or 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
| Given(~"I access the resource url \"([^\"]*)\"") { String url -> | |
| resp = null | |
| status = null | |
| uri = new URIBuilder(host) | |
| path = url | |
| } | |
| Given(~"I provide parameter \"([^\"]*)\" as \"([^\"]*)\"") { String name, String value -> | |
| uri.addQueryParam name, value |
This file contains hidden or 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
| @Positive @Get @User | |
| Scenario: Show twitter user | |
| Given I access the resource url "/1/users/show.json" | |
| And I provide parameter "screen_name" as "jasonh_n_austin" | |
| And I provide parameter "include_entities" as "true" | |
| When I retrieve the results | |
| Then the status code should be 200 | |
| And it should have the field "name" containing the value "Jason Harmon" | |
| And it should have the field "id" containing the value "57005215" |
This file contains hidden or 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
| Then(~"it should have the field \"(.*)\" containing the value \"(.*)\"") { String field, String value -> | |
| assert parsed."${field}".toString().equals(value) | |
| } |
This file contains hidden or 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
| Content: | |
| Level 3 REST Makes Your API Browsable - Matt Bishop, Elastic Path | |
| http://www.slideshare.net/matt_bishop5/l3-rest | |
| Platforms are Social – Tyler Singletary, Klout | |
| http://www.slideshare.net/harmophone/api-strategy-harmophone | |
| Adopt a Successful API Product Mindset – Chris Haddad, WS02 | |
| http://www.slideshare.net/sa/f9a452c1cddc4cb8ad2c54661f801858 |
This file contains hidden or 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
| GET /widget/5 | |
| { | |
| "id": 5, | |
| "code": "abc123", | |
| "name": "Widget I know of" | |
| } |
OlderNewer