All Projects → vimalrajselvam → test-graphql-java

vimalrajselvam / test-graphql-java

Licence: MIT License
Easy Graphql Testing in Java

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to test-graphql-java

reky
Reky is an opensource API development platform. It automatically visualizes API response with outstanding graphs & tables.
Stars: ✭ 22 (+0%)
Mutual labels:  api-testing
karate-runner
VSCode Extension for Karate
Stars: ✭ 23 (+4.55%)
Mutual labels:  api-testing
http-rider
Simple and Powerful desktop client for working with JSON APIs
Stars: ✭ 27 (+22.73%)
Mutual labels:  api-testing
graphql-java-codegen-gradle-plugin
Gradle plugin for graphql-java-codegen
Stars: ✭ 19 (-13.64%)
Mutual labels:  graphql-java
api-test
🌿 A simple bash script to test JSON API from terminal in a structured and organized way.
Stars: ✭ 53 (+140.91%)
Mutual labels:  api-testing
pactum
REST API Testing Tool for all levels in a Test Pyramid
Stars: ✭ 190 (+763.64%)
Mutual labels:  api-testing
cygger
Boilerplate generator for API Testing from Swagger to Cypress
Stars: ✭ 20 (-9.09%)
Mutual labels:  api-testing
api-test-helper
A collection of helper methods for testing and debugging API endpoints.
Stars: ✭ 50 (+127.27%)
Mutual labels:  api-testing
software-testing-resource-pack
Various files useful for manual testing and test automation etc.
Stars: ✭ 38 (+72.73%)
Mutual labels:  api-testing
API-Testing-Automation-Framework
It is Data-Driven and Keyword-Driven framework to test REST/SOAP webservices automatically
Stars: ✭ 24 (+9.09%)
Mutual labels:  api-testing
karate
Test Automation Made Simple
Stars: ✭ 6,384 (+28918.18%)
Mutual labels:  api-testing
graphql-java-codegen
Make your GraphQL Java application schema-driven.
Stars: ✭ 167 (+659.09%)
Mutual labels:  graphql-java
membership
Membership service (to demonstrate graphQL)
Stars: ✭ 19 (-13.64%)
Mutual labels:  graphql-java
vertx-graphql-example
Vert.x Server which exposes a GraphQL API
Stars: ✭ 29 (+31.82%)
Mutual labels:  graphql-java
apitest
Apitest is declarative api testing tool with JSON-like DSL.
Stars: ✭ 88 (+300%)
Mutual labels:  api-testing
graphql-filter-java
This project is developed to help developers add filtering support to their graphql-java services
Stars: ✭ 52 (+136.36%)
Mutual labels:  graphql-java
irontest
A web app for API test automation
Stars: ✭ 31 (+40.91%)
Mutual labels:  api-testing
graphql-starwars-kotlin
GraphQL Server implemented in Kotlin.
Stars: ✭ 31 (+40.91%)
Mutual labels:  graphql-java
super-powered-api-testing
Comparisons of powerful API testing tools
Stars: ✭ 25 (+13.64%)
Mutual labels:  api-testing
artillery-plugin-expect
✅ Add checks and assertions to your HTTP tests for functional testing with Artillery
Stars: ✭ 27 (+22.73%)
Mutual labels:  api-testing

Build Status Maven Central

Test GraphQL Java

This library let's you to convert the GraphQL file to a simple string which can be used as a request payload using any HTTP client library.

I've written this library for the simple GraphQL API Testing. There is a graphql-java library which let's you to implement GraphQL server in Java. My main goal is not to introduce Spring Boot just for the sake of testing the GraphQL API. I wanted to keep it simple!

To use this library, you can download from Maven:

<dependency>
    <groupId>com.vimalselvam</groupId>
    <artifactId>test-graphql-java</artifactId>
    <version>1.0.0</version>
</dependency>

I don't use Gradle, but it should be simple to add this as a gradle dependency.

Getting Started

There are two ways to load the GraphQL file.

  • using InputStream:

    InputStream iStream = getClass().getResourceAsStream("/graphql/pokemon.graphql");

    Here the pokemon.graphql file in under src/test/resources/graphql/pokemon.graphql.

  • using File:

    File file = new File("src/test/resources/graphql/pokemon.graphql");

Once you read the file, just pass it to GraphqlTemplate class to parse as follows:

String graphqlPayload = GraphqlTemplate.parseGraphql(file, variables);

Here the variables is the com.fasterxml.jackson.databind.node.ObjectNode. If no variables, you just pass null.

To build the variables, you can do:

ObjectNode variables = new ObjectMapper().createObjectNode();
variables.put("name", "Pikachu");

Then you can use any HTTP Client and pass the graphqlPayload string as a body.

A sample test can be found here

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].