New feature: Support for WebSocket as protocol
Opened this issue · 0 comments
osoykan commented
We have http
protocol to interact with. But users also in the need of having a WebSocket protocol to test their systems.
http
system leverages ktor client to make requests against the Application Under Test (AUT). With a little search I have discovered that WebSocket plugin for Ktor client can be easily installed.
https://ktor.io/docs/server-create-websocket-application.html#add-automated-tests
val client = createClient {
install(ContentNegotiation) {
json()
}
install(WebSockets) {
contentConverter = KotlinxWebsocketSerializationConverter(Json)
}
}
After enabling WebSockets
, we can create an API on HttpSystem to interact with AUTs websocket endpoints.
One example could be (on Stove's http dsl)
http {
webSocket("/chat") { actual ->
// we need to think more about the `actual` reference here,
// what could possibly be the best object to interact and assert with 🤔
}
}