-
Notifications
You must be signed in to change notification settings - Fork 317
WebGraphQlTester Auto Config Improvements #75
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
Comments
This is now fixed. Looking at the table above, we're supporting now the following test profiles:
|
Hope there is an option for testing WebSocket transport protocol on a live server.
|
What you're asking for is #163 - this issue is about making #163 (comment) simpler with |
Reopening for further refinements. |
After recent changes in #65 to create a
WebGraphQlTester
as a sub-type ofGraphQlTester
, there are now three ways to create a tester, performing requests throughWebTestClient
,WebGraphQlHandler
, orGraphQlService
which gives the following possibilities:1-4 are the most likely choice for GraphQL over HTTP tests. 5-6, as well as 7-8, can be used to test subscriptions without WebSocket and that's useful because we don't yet support testing GraphQL over WebSocket.
If applications declare
@SpringBootTest
,@AutoConfigureGraphQlTester
, and either@AutoConfigureMockMvc
or@AutoConfigureWebTestClient
they getWebGraphQlTester
created withWebTestClient
, i.e. 1-4.If however
@AutoConfigureMockMvc
or@AutoConfigureWebTestClient
are left out, applications getWebGraphQlTester
created withWebGraphQlHandler
, i.e. 5-6.This makes sense overall but it can lead to issues, e.g. where you end up with 5-6 (no web framework) by accident, simply because you maybe forgot to declare
@AutoConfigureMockMvc
or@AutoConfigureWebTestClient
. Now it may appear to work but if you rely onWebTestClient
, and likewise the web framework, to be pre-configured for Spring Security, then you're missing an essential part of the setup.We should consider ways to make the tester auto config so that the choices are more explicit, and likewise more intuitive if no explicit choices are made. This could mean for example that the combination of
@SpringBootTest
and@AutoConfigureGraphQlTester
give the most complete, and intuitive choice, in this case one of 1-4 by default, but you can otherwise override this by choosing an enum attribute on@AutoConfigureGraphQlTester
for "web interceptor chain" or "graphql service" only.The text was updated successfully, but these errors were encountered: