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

MegaIssue: testing utilities #6076

Open
6 tasks
martinbonnin opened this issue Jul 25, 2024 · 0 comments
Open
6 tasks

MegaIssue: testing utilities #6076

martinbonnin opened this issue Jul 25, 2024 · 0 comments

Comments

@martinbonnin
Copy link
Contributor

martinbonnin commented Jul 25, 2024

This is a high level umbrella issue for issues related to testing utilities.

There are currently 2 main ways to obtain Operation.Data instances for testing:

  1. calling the data class constructor directly.
  2. capturing a JSON and then parsing it into Operation.Data instances.

Solution 1. is cumbersome because there are a lot of parameters to pass. Also in polymorphic cases, we add __typename automatically and figuring out what __typename to pass in the constructor can be confusing.

Solution 2. is cumbersome because editing JSON isn't fun. There's no autocomple/IDE support and the JSON are quite large. Also, if for some reason, the JSON shape isn't the expected one, parsing will just fail.

Also, none of these solutions allow automatically faking field values. Every field must be explicitely provided.

Data Builders attempt to fix those issues by providing a DSL to create fake Operation.Data instances. They suffer from some limitations though:

Now that we have execution algorithms, we could use them to provide a "true" schema based testing experience. This is also what the web client is doing at the moment, see https://www.youtube.com/watch?v=TCp3P5gAacA

Linked issues:

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

No branches or pull requests

1 participant