Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/martinohmann/godog-http
Feature context for godog that adds http testing steps
https://github.com/martinohmann/godog-http
bdd cucumber gherkin golang http integration-testing
Last synced: about 1 month ago
JSON representation
Feature context for godog that adds http testing steps
- Host: GitHub
- URL: https://github.com/martinohmann/godog-http
- Owner: martinohmann
- License: mit
- Created: 2019-03-18T19:19:50.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-20T19:16:54.000Z (almost 6 years ago)
- Last Synced: 2024-10-12T05:22:47.337Z (2 months ago)
- Topics: bdd, cucumber, gherkin, golang, http, integration-testing
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
godog-http
==========[![Build Status](https://travis-ci.org/martinohmann/godog-http.svg)](https://travis-ci.org/martinohmann/godog-http)
[![codecov](https://codecov.io/gh/martinohmann/godog-http/branch/master/graph/badge.svg)](https://codecov.io/gh/martinohmann/godog-http)
[![Go Report Card](https://goreportcard.com/badge/github.com/martinohmann/godog-http)](https://goreportcard.com/report/github.com/martinohmann/godog-http)
[![GoDoc](https://godoc.org/github.com/martinohmann/godog-http?status.svg)](https://godoc.org/github.com/martinohmann/godog-http)godog-http defines a godog feature context which adds steps to test `http.Handler` implementations.
Installation
------------```sh
go get -u github.com/martinohmann/godog-http
```Usage
-----Example feature:
```
Feature: As a developer, I want to be able to setup and verify http routers in
godog features.Scenario: I make a JSON request
Given I have following request headers:
| name | value |
| X-Auth | supersecret |
And I have following request body:
"""
{"foo":{"bar":{"baz":1}},"something":"else"}
"""
When I send "POST" request to "/foo"
Then the response code should be 200
And the response should contain following json:
"""
{"something":"else","foo":{"bar":{"baz":1}}}
"""
And the response should have following headers:
| name | value |
| Content-Type | application/json |
```Check [`feature_context_test.go`](feature_context_test.go) and the
[`features/`](features/) directory for more usage examples.License
-------The source code of godog-http is released under the MIT License. See the bundled
LICENSE file for details.