You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently Helidon 4 supports unit tests and integration tests using @ServerTest and @RoutingTest. The JUnit extension adds support for injection of Http1Client (for server test) and DirectClient (for unit tests, also implements Http1Client but bypasses HTTP protocol and directly invokes routing).
This issue is to add similar support for other protocols. Both @ServerTest and @RoutingTest should be applicable to any protocol testing.
The following should be added:
support for routing using the protocol specific routing type (e.g. for WebSocket, it would be WebSocketRouting), now we support HttpRouting and Router.Builder (second can be used to configure any routing, but only works with @ServerTest)
support for injecting client for other protocols that is pre-configured for the correct host and port (@ServerTest)
support for injecting a direct client for other protocols that invokes routing directly and bypasses socket communication (for @RoutingTest)
all of this should be done in a modularized way - e.g. you only want to support WebSocket if websocket is on classpath (or add a specific web socket testing module), but only use a single JUnit extension (so we can reuse the exact same annotations for all protocols)
Example of a test I want to be able to define:
@ServerTest
class MyHttp2IT {
private final Http2Client client;
MyHttp2IT(Http2Client client) {
this.client = client;
}
}
@RoutingTest
class MyHttp2Test {
private final Http2DirectClient client;
MyHttp2Test(Http2DirectClient client) {
this.client = client;
}
}
@ServerTest
class MyWebsocketIT {
private final WebSocketClient client; // we do not have a websocket client yet, this is the concept
MyHttp2IT(WebSocketClient client) {
this.client = client;
}
@SetUpRoute
void routing(WebSocketRouting.Builder routing) {
...
}
}
@RoutingTest
class MyWebSocketTest {
private final DirectWebSocketClient client; // we do not have a websocket client yet, this is the concept
MyHttp2IT(DirectWebSocketClient client) {
this.client = client;
}
@SetUpRoute
void routing(WebSocketRouting.Builder routing) {
...
}
The text was updated successfully, but these errors were encountered:
tomas-langer
changed the title
Testing story - good for HTTP/1, need the same for HTTP/2, gRPC, graphQL, Security, WebSocket
Nima Testing story
Nov 14, 2022
We have support for HTTP/1
Need similar support for:
Currently Helidon 4 supports unit tests and integration tests using
@ServerTest
and@RoutingTest
. The JUnit extension adds support for injection of Http1Client (for server test) and DirectClient (for unit tests, also implements Http1Client but bypasses HTTP protocol and directly invokes routing).This issue is to add similar support for other protocols. Both
@ServerTest
and@RoutingTest
should be applicable to any protocol testing.The following should be added:
WebSocketRouting
), now we supportHttpRouting
andRouter.Builder
(second can be used to configure any routing, but only works with@ServerTest
)@ServerTest
)@RoutingTest
)Example of a test I want to be able to define:
The text was updated successfully, but these errors were encountered: