3
GraphQL query variable as input in Unit Test
Source: Kong/insomnia#4975 · opened by @eddex
Problem
Using a *design document*, I created a *query* and a *unit test* that runs tests on that query. The query has a *query variable* which is configured as part of the query in the "Debug" tab in Insomnia.
Query:
Query variables:
On the "Tests" tab I can create a unit test and select the "Test" query. Is it possible to pass in different query variables as the one configured in the "Debug" tab?
E.g. I want to run the unit test but instead of the query variable configured in the "Debig" tab, I want to pass in something like:
My current solution is to duplicate the query in the "Debug" tab for each unit test. While this works, it obviously creates a lot of duplication which makes adapting the tests to changes in the GraphQL schema a lot more labor intense than it could be.
Idea
It would be great if the query variables could be overridden in the unit test itself.
E.g. like this:
Using a *design document*, I created a *query* and a *unit test* that runs tests on that query. The query has a *query variable* which is configured as part of the query in the "Debug" tab in Insomnia.
Query:
Query variables:
On the "Tests" tab I can create a unit test and select the "Test" query. Is it possible to pass in different query variables as the one configured in the "Debug" tab?
E.g. I want to run the unit test but instead of the query variable configured in the "Debig" tab, I want to pass in something like:
My current solution is to duplicate the query in the "Debug" tab for each unit test. While this works, it obviously creates a lot of duplication which makes adapting the tests to changes in the GraphQL schema a lot more labor intense than it could be.
Idea
It would be great if the query variables could be overridden in the unit test itself.
E.g. like this:
No pledges yet. Be the first to back this.
Comments
Similar requests
Override Environment for Testing a Request in Unit Tests
3 votes · 0 comments
Integrate trigger behavior with unit tests
3 votes · 0 comments
Improved autocomplete in GraphQL variables editor (fields of input types)
1 vote · 0 comments
Autofill GraphQL request from Documentation Fields
2 votes · 0 comments
Add better support for file uploads to graphQL
8 votes · 0 comments
No comments yet.