TestApplicationEngine
class TestApplicationEngine(environment: <ERROR CLASS>, configure: TestApplicationEngine.Configuration.() -> Unit) : CoroutineScope
Content copied to clipboard
A test engine that provides a way to simulate application calls to the existing application module(s) without actual HTTP connection.
Constructors
Link copied to clipboard
fun TestApplicationEngine(environment: <ERROR CLASS> = createTestEnvironment(), configure: TestApplicationEngine.Configuration.() -> Unit = {})
Content copied to clipboard
Types
Functions
Link copied to clipboard
fun createCall(readResponse: Boolean = false, closeRequest: Boolean = true, context: CoroutineContext = Dispatchers.IOBridge, setup: TestApplicationRequest.() -> Unit): TestApplicationCall
Content copied to clipboard
Creates an instance of a 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
Makes a test request.
Link copied to clipboard
fun handleWebSocket(uri: String, setup: TestApplicationRequest.() -> Unit): TestApplicationCall
Content copied to clipboard
Makes a test request that sets up a websocket session and waits for completion.
Link copied to clipboard
fun hookRequests(processRequest: TestApplicationRequest.(setup: TestApplicationRequest.() -> Unit) -> Unit, processResponse: TestApplicationCall.() -> Unit, block: () -> Unit)
Content copied to clipboard
Installs a hook for test requests.
Link copied to clipboard
Properties
Extensions
Link copied to clipboard
Keeps cookies between requests inside the callback.
Link copied to clipboard
fun TestApplicationEngine.handleRequest(method: <ERROR CLASS>, uri: String, setup: TestApplicationRequest.() -> Unit = {}): TestApplicationCall
Content copied to clipboard
Makes a test request.
Link copied to clipboard
fun TestApplicationEngine.handleWebSocketConversation(uri: String, setup: TestApplicationRequest.() -> Unit = {}, awaitCallback: Boolean = true, callback: suspend TestApplicationCall.(incoming: ReceiveChannel<Frame>, outgoing: SendChannel<Frame>) -> Unit): TestApplicationCall
Content copied to clipboard
Makes a test request that sets up a WebSocket session and invokes the callback function that handles conversation with the server