thefrontside / graphgen

Complete, realistic, and repeatable fake datasets
https://frontside.com/graphgen
16 stars 0 forks source link

Working against real API #64

Open megetron opened 1 year ago

megetron commented 1 year ago

hey there, just ran into this project and i find it really useful and well documented so i am trying to evaluate to the needs of a test environment i am currently building.

while this project seems like a very good implementation of mocking the server side, this test project is end-to-end project and aim to call graphql endpoint to actually ask the API to insert the data to the database (mongodb).

can you think of a way to create the graphql mutations and executes it against the GRAPHQL API?

taras commented 1 year ago

Hi @megetron, thank you for checking out the project. Does your GraphQL API provide mutations for populating every type in your API? It might be easier to create a meta API that would take raw data as input and write to MongoDB without hitting GraphQL.

megetron commented 1 year ago

thanks @taras

the idea of the end-to-end testing is to hit the graphql to create the data - so i can test it's behaviour as well.

since not all types are in the API i will have to manipulate mongodb as well for special cases.

maybe i am looking for something like this: https://levelup.gitconnected.com/how-i-save-a-few-hours-each-week-on-testing-graphql-in-nest-js-typescript-1afd8ceeacf7

since in the current implementation of the graphgen, it mocks the data instead of hitting the API which is great but not exactly what i was looking for.

Just a moment...
taras commented 1 year ago

GraphGen is designed to be one of the tools used to create a simulation solution. It generates data graphs queried in simulators to ensure that your simulator provides realistic-looking data.

You still need to implement the simulator. We've written simulators for GraphQL that expose a GraphQL API but are resolved by GraphGen data. I think that's what you're looking for. In this setup, there is no MongoDB involved, but you need to write that simulator that'll query the GraphGen-generated data.