Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working against real API #64

Open
megetron opened this issue Jul 11, 2023 · 3 comments
Open

Working against real API #64

megetron opened this issue Jul 11, 2023 · 3 comments

Comments

@megetron
Copy link

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
Copy link
Member

taras commented Jul 11, 2023

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
Copy link
Author

megetron commented Jul 13, 2023

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.

@taras
Copy link
Member

taras commented Jul 13, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants