Sha256: f336ee66a274e70a0aac506f7be15f194544ef9ba5efcb437c16dac5f4da149c

Contents?: true

Size: 1.96 KB

Versions: 5

Compression:

Stored size: 1.96 KB

Contents

# https://github.com/HackerNews/API
Feature: Hacker News REST API validation

  Scenario: Verify top stories JSON schema
    Given I send and accept JSON
    And I add Headers:
      | Cache-Control | no-cache |
    When I send a GET request to "https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty"
    Then the response status should be "200"
    And the JSON response should follow "features/schemas/topstories.json"

  Scenario Outline: Verify item JSON schema
    When I send and accept JSON
    And I send a GET request to "https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty"
    Then the response status should be "200"
    And the JSON response root should be array
    When I grab "$[0]" as "id"
    And I send a GET request to "https://hacker-news.firebaseio.com/v0/item/{id}.json" with:
      | print  |
      | pretty |
    Then the response status should be "200"
    And the JSON response root should be object
    And the JSON response should have <optionality> key "<key>" of type <value type>
    And the JSON response should have "id" of type numeric and value "{id}"

    Examples:
      | key   | value type | optionality |
      | id    | numeric    | required    |
      | score | numeric    | required    |
      | url   | string     | optional    |

  Scenario: Demonstrate setting the JSON body with a docstring
    Given I send and accept JSON
    And   I set JSON request body to:
    """
    {
      "title": "foo",
      "body":  "bar",
      "userId": 1
    }
    """
    When I send a POST request to "http://jsonplaceholder.typicode.com/posts"
    Then the response status should be "201"
    And  the JSON response should have "id" of type numeric and value "101"
    And  the JSON response should have "title" of type string and value "foo"
    And  the JSON response should have "body" of type string and value "bar"
    And  the JSON response should have "userId" of type numeric and value "1"

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alinta-cucumber-api-0.5.5 features/sample.feature
alinta-cucumber-api-0.5.4 features/sample.feature
alinta-cucumber-api-0.5.3 features/sample.feature
alinta-cucumber-api-0.5.2 features/sample.feature
alinta-cucumber-api-0.5.1 features/sample.feature