ghatt

module
v1.2.26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2021 License: MIT

README

ghatt

Graphql and HTTP API Testing Tool

Installation:

GO111MODULE=on go get github.com/cucumber/godog/cmd/[email protected]
GO111MODULE=on go get github.com/miko/ghatt/cmd/ghatt

Usage:

cat > example.feature << EOF
Feature: Query countries
  As a graphql developer
  I want to test ghatt with sample countries database
  So I know how to test graphql

  Background: Set up
    Given I remember "GRAPHQL_ENDPOINT" as "https://countries.trevorblades.com/"
    And I remember "COUNTRIES_LIST" as:
    """
query {
  countries {
    code
    capital
    name
  }
}
    """
    And I remember "COUNTRY_BY_CODE" as:
    """
query ($code:String!="US") {
  countries (filter:{code:{eq:$code}}) {
    capital
    name
   continent {name}
  }
}
    """

  Scenario: Get code, capital and name of all countries
    When I execute query "COUNTRIES_LIST"
    Then the response code should be 200
    And the response jq ".data.countries|length" should match number "250"

  Scenario: Get info abount Poland by code
    Given I set variable "code" as "PL"
    When I execute query "COUNTRY_BY_CODE"
    Then the response code should be 200
    And I dump response as JSON
    And the response should match subset of json:
    """
    {"data":{
    "countries":[
    {"name":"Poland", "capital":"Warsaw", "continent":{"name":"Europe"}}
    ]
      }}
    """
EOF

ghatt ./example.feature

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL