Graphql-engine: docs: add guide on how to test hasura

Created on 15 Oct 2019  路  4Comments  路  Source: hasura/graphql-engine

We should write a guide on how to test Hasura GraphQL engine.

This is Leo Alves's input:

1 - Schema tests. To make sure each role has access to the correct schema. For that I use easy-grphql-test (I think that is the name of the library). I save each Hasura role schema into a file and validate if the schema is correct based on the permissions setup in Hasura. To make sure a user can't access private fields or access operations that are only for managers, etc. This won't validate the data that is returned, for example if both user and manager have access to the field email the tests will pass in this phase.

2 - End to End tests - For this one I usually use Puppeteer and test if the UI is rendering the expected data for each role. Here is where I expect to catch when the user has access to more data then they were supposed to.

docs

Most helpful comment

Adding test to hasura-auth with: bash, hasura, docker, nodejs and jest
https://youtu.be/gaV4UnXQmGw

I'll be release a tool to help test a hasura project.

All 4 comments

@shahidhk please add your thoughts on this 馃檪

These are good. Another strategy is to execute all operations that are used by the app against the Hasura instance. This can be done using a simple script or any testing framework.

Adding test to hasura-auth with: bash, hasura, docker, nodejs and jest
https://youtu.be/gaV4UnXQmGw

I'll be release a tool to help test a hasura project.

Rodolfo, that video is great! I'm currently working out how to build some regression tests (open source/hasura core instance) and it's really helpful to see your implementation.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

revskill10 picture revskill10  路  3Comments

marionschleifer picture marionschleifer  路  3Comments

bogdansoare picture bogdansoare  路  3Comments

egislook picture egislook  路  3Comments

anisjonischkeit picture anisjonischkeit  路  3Comments