TestApplicationEngine
class TestApplicationEngine(environment: ApplicationEngineEnvironment, configure: TestApplicationEngine.Configuration.() -> Unit) : BaseApplicationEngine, CoroutineScope
Content copied to clipboard
ktor test engine that provides way to simulate application calls to existing application module(s) without actual HTTP connection
Constructors
Link copied to clipboard
fun TestApplicationEngine(environment: ApplicationEngineEnvironment = createTestEnvironment(), configure: TestApplicationEngine.Configuration.() -> Unit = {})
Content copied to clipboard
Types
Functions
Link copied to clipboard
fun createCall(readResponse: Boolean = false, closeRequest: Boolean = true, setup: TestApplicationRequest.() -> Unit): TestApplicationCall
Content copied to clipboard
Creates an instance of test call but doesn't start request processing
Link copied to clipboard
fun handleRequest(closeRequest: Boolean = true, setup: TestApplicationRequest.() -> Unit): TestApplicationCall
Content copied to clipboard
Make a test request
Link copied to clipboard
fun handleWebSocket(uri: String, setup: TestApplicationRequest.() -> Unit): TestApplicationCall
Content copied to clipboard
Make a test request that setup a websocket session and wait for completion
Link copied to clipboard
fun handleWebSocketConversation(uri: String, setup: TestApplicationRequest.() -> Unit = {}, callback: suspend TestApplicationCall.(incoming: ReceiveChannel<Frame>, outgoing: SendChannel<Frame>) -> Unit): TestApplicationCall
Content copied to clipboard
Make a test request that setup a websocket session and invoke callback function that does conversation with server
Link copied to clipboard
fun hookRequests(processRequest: TestApplicationRequest.(setup: TestApplicationRequest.() -> Unit) -> Unit, processResponse: TestApplicationCall.() -> Unit, block: () -> Unit)
Content copied to clipboard
Install a hook for test requests
Link copied to clipboard
Properties
Link copied to clipboard
An instance of client engine user to be used in client.
Extensions
Link copied to clipboard
Keep cookies between requests inside the callback.
Link copied to clipboard
fun TestApplicationEngine.handleRequest(method: HttpMethod, uri: String, setup: TestApplicationRequest.() -> Unit = {}): TestApplicationCall
Content copied to clipboard
Make a test request