TestApplicationEngine

class TestApplicationEngine(environment: ApplicationEnvironment = createTestEnvironment(), monitor: Events, developmentMode: Boolean = true, applicationProvider: () -> Application, configuration: TestApplicationEngine.Configuration) : BaseApplicationEngine, CoroutineScope

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
constructor(environment: ApplicationEnvironment = createTestEnvironment(), monitor: Events, developmentMode: Boolean = true, applicationProvider: () -> Application, configuration: TestApplicationEngine.Configuration)

Types

Link copied to clipboard

An engine configuration for a test application.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

An instance of a client engine to be used in client.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Keeps cookies between requests inside the callback.

Link copied to clipboard
fun createCall(readResponse: Boolean = false, closeRequest: Boolean = true, context: CoroutineContext = Dispatchers.IOBridge, setup: TestApplicationRequest.() -> Unit): TestApplicationCall

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

Makes a test request.

Link copied to clipboard

Makes a test request.

Link copied to clipboard

Makes a test request that sets up a websocket session and waits for completion.

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

Makes a test request that sets up a WebSocket session and invokes the callback function that handles conversation with the server

Link copied to clipboard
fun hookRequests(processRequest: TestApplicationRequest.(setup: TestApplicationRequest.() -> Unit) -> Unit, processResponse: TestApplicationCall.() -> Unit, block: () -> Unit)

Installs a hook for test requests.

Link copied to clipboard
open suspend override fun resolvedConnectors(): List<EngineConnectorConfig>
Link copied to clipboard
open override fun start(wait: Boolean): ApplicationEngine
Link copied to clipboard
open override fun stop(gracePeriodMillis: Long, timeoutMillis: Long)