Comments (6)
We started to work on compatibility acceptance tests here:
https://github.com/graphql-cats/graphql-cats
If you are working on a GraphQL implementation, it would be great if you could share your opinion and join us.
from graphql-spec.
I'm going to close this issue since graphql-cats is well underway!
from graphql-spec.
Thanks, for opening this. I'm renaming the task to use the terminology we have been using to talk about this.
We agree that this is really important, but are not yet actively working on it.
from graphql-spec.
do you already have an idea which form it will take?
Sort of.
I think it will specify a schema to implement, along with a data set to use. Ideally this schema is as small as possible while still illustrating every feature of GraphiQL and supporting all of the acceptance tests. Ideally this schema is written in the GraphQL Type DSL so it is easy to understand.
Then there should be a list of "tests" where each test includes the following:
- Description: what is this test testing and why
- Query: a document to submit to the GraphQL service
- Response: The response expected from the GraphQL service
Then optionally also include Variables and OperationName when those are relevant to a test.
This form should allow us to test everything from parser corner cases and proper detection and reporting of syntax errors, to validation errors for all the rules we specify, to execution behavior.
from graphql-spec.
I guess implementing something like this can be a challenging task, considering that it suppose to test implementations written in different languages.
Ideally, the form I wrote above only needs to be written once and can leverage the fact that the GraphQL language is represented as a string independent of any one backend language and the output can be serialized to JSON.
However the provided schema still needs to be implemented by that backend. Either by interpreting the GraphQL Type DSL or by manually implementing it. Hopefully that is not too much of a burden.
However overall I would certainly rate this task as "challenging" :D
from graphql-spec.
Thanks for the reply! Glad to hear that you already thought about it. The approach you described sounds good to me. I was also thinking about something like this.
About the schema, reference implementation now has a schema materialiser, which also can be implemented in other languages. Resulting schema does not contain the resolve method, but even in this form it can be used for many tests that do not require execution, like query validation and parsing or introspection. As far as I saw, even execution tests have very similar resolve
implementations, which are in most cases fall in one of these categories:
- successful resolve with
null
- successful resolve with not-null value
- successful resolve of promise with
null
- successful resolve of promise with not-null value
- exception is thrown
- promise was resolved with failure
Maybe we can create an enum of possible implementation behaviours and then enhance textual schema representation to include this information in some form. This will allow schema materialiser to create simple implementations of resolve method. This means that a test schema can be completely generated from textual description, just like test cases. What do you think about this idea?
from graphql-spec.
Related Issues (20)
- GraphQL Mutation how to make fields optional to update fields only by selection and generate schema HOT 1
- [RFC] Non-existent request field operator HOT 8
- (Graphql-schema) Cannot query field "closeDiscussion" on type "Mutation" HOT 1
- GraphQL spec is contradictory: can selection sets be empty or not? HOT 1
- Allow to return Input Object types HOT 1
- Formalize Global Object Identification.
- Grammar should have single root node HOT 2
- [Feature request]: Support non-list variables for list arguments HOT 9
- Redundant field aliases identical to field names
- Document Level Directives HOT 7
- Coercing Variable Values when hasValue is not true and defaultValue does NOT exist HOT 7
- Strawman: mention of non-self-describing responses
- why not allow directive on field argument ? HOT 2
- On specifying ordered vs unordered enum definitions HOT 5
- Casting Error in GraphQL C# Library HOT 2
- Is there a reason graphql floats do not support Infinity and NaN? HOT 3
- Composite types is not clearly defined HOT 1
- Unclear spec for array with fragments HOT 1
- What must be the result of executing only one fragment on a list of union or interface type? HOT 3
- Interface conditions fragments may not be used across spreads, discouraging reusability HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-spec.