Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ohler55/graphql-test-tool
GraphQL Test Tool for running tests cases against a GraphQL server
https://github.com/ohler55/graphql-test-tool
golang golang-package graphql graphql-test gtt test testing testing-tools
Last synced: 12 days ago
JSON representation
GraphQL Test Tool for running tests cases against a GraphQL server
- Host: GitHub
- URL: https://github.com/ohler55/graphql-test-tool
- Owner: ohler55
- License: mit
- Created: 2019-12-12T11:41:10.000Z (almost 5 years ago)
- Default Branch: develop
- Last Pushed: 2022-12-24T02:36:43.000Z (almost 2 years ago)
- Last Synced: 2024-10-03T12:39:13.404Z (about 1 month ago)
- Topics: golang, golang-package, graphql, graphql-test, gtt, test, testing, testing-tools
- Language: Go
- Size: 95.7 KB
- Stars: 33
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# GraphQL-Test-Tool
GraphQL Test Tool for running tests cases against a GraphQL server.
## What It Is
The GraphQL Test Tool (gtt) helps test GraphQL servers. Tests are
referred to as use cases and each use case in defined in a JSON
file. Some of the features of gtt are:- Both GET and POST HTTP requests can be made.
- POST content can be either JSON (application/json) or GraphQL (application/graphql).
- Variables and operation name can be specified in the URL or in JSON content,
- Values can be remembered and reused in subsequent steps.
- Various display options.
- Can be run as an application or the gtt package can be used in unit tests.## Usage
The GraphQL Test Tool can be run as an application:
```
go run main.go -s http://localhost:6464 -i 2 -v ../examples/top.json
```
The gtt package can be use for unit testing as well. Create the use case files and```
uc, err := gtt.NewUseCase("myfile.json"')
if err != nil {
return err
}
runner := gtt.Runner{
Server: "http://localhost:6464",
Base: "/graphql",
UseCases: []*gtt.UseCase{uc},
}
if err = r.Run(); err != nil {
return err
}
```All tests are driven by use case JSON files. The format is described
in [file_format.md](file_format.md). Some example files are in the
`examples` directory and a simple test server can be set up using the
files in the `test` directory.## Installation
```
go get github.com/ohler55/graphql-test-tool
```## GoDocs
Documentation is at [https://ohler55.github.io/graphql-test-tool](https://ohler55.github.io/graphql-test-tool).
## Releases
See [CHANGELOG.md](CHANGELOG.md)