@@ -6,8 +6,8 @@ include::attributes.adoc[]
6
6
[[testing]]
7
7
= Testing
8
8
9
- Spring for GraphQL provides dedicated support for testing GraphQL requests over HTTP or
10
- WebSocket, and for testing GraphQL requests executed directly against a server.
9
+ Spring for GraphQL provides dedicated support for testing GraphQL requests over HTTP,
10
+ WebSocket, and RSocket, as well as for testing directly against a server.
11
11
12
12
To make use of this, add `spring-graphql-test` to your build:
13
13
@@ -43,14 +43,15 @@ dependencies {
43
43
independent of and agnostic to the underlying transport. To create an instance, you'll
44
44
need to choose a specific `GraphQlTester` extension as a starting point.
45
45
46
- To test with a client sending requests to a server over a transport, use the
47
- <<testing-httpgraphqltester>> or the <<testing-websocketgraphqltester>> `GraphQlTester`
48
- extensions. For server side tests, executed without any client, use the
49
- <<testing-graphqlservicetester>> or the <<testing-webgraphqlhandlertester>> extensions.
46
+ To test with a client sending requests over a transport, use one of the
47
+ <<testing-httpgraphqltester>>, <<testing-websocketgraphqltester>>, or
48
+ <<testing-rsocketgraphqltester>> extensions. To test the server without client,
49
+ use the<<testing-graphqlservicetester>> or <<testing-webgraphqlhandlertester>>
50
+ extensions.
50
51
51
- The main purpose of a `GraphQlTester` extension is to provide a transport specific
52
- `Builder`. There is also a <<testing-graphqltester-builder>> in `GraphQlTester` with
53
- common configuration options that apply to any extension .
52
+ Each `GraphQlTester` extension provides a transport specific `Builder`. There is also a
53
+ shared, base <<testing-graphqltester-builder>> in `GraphQlTester` with common options
54
+ for all extensions .
54
55
55
56
56
57
@@ -148,7 +149,7 @@ from Spring WebFlux to execute GraphQL requests over WebSocket:
148
149
----
149
150
150
151
Once created, `WebSocketGraphQlTester` exposes the same transport agnostic workflow for
151
- request execution as any `GrahQlTeste `. To change any transport details, use `mutate()`
152
+ request execution as any `GraphQlTester `. To change any transport details, use `mutate()`
152
153
on an existing `WebSocketGraphQlTester` to create another with different configuration:
153
154
154
155
[source,java,indent=0,subs="verbatim,quotes"]
@@ -174,6 +175,24 @@ connection closed, e.g. after a test runs.
174
175
175
176
176
177
178
+ [[testing-rsocketgraphqltester]]
179
+ === RSocket
180
+
181
+ `RSocketGraphQlTester` uses `RSocketRequester` from spring-messaging to execute GraphQL
182
+ requests over RSocket:
183
+
184
+ [source,java,indent=0,subs="verbatim,quotes"]
185
+ ----
186
+ RSocketGraphQlTester tester = RSocketGraphQlTester.builder()
187
+ .webSocket(URI.create("http://localhost:8080/graphql"))
188
+ .build();
189
+ ----
190
+
191
+ Once created, `RSocketGraphQlTester` exposes the same transport agnostic workflow for
192
+ request execution as any `GraphQlTester`.
193
+
194
+
195
+
177
196
[[testing-graphqlservicetester]]
178
197
=== `GraphQlService`
179
198
0 commit comments