TestApplicationEngine

class TestApplicationEngine(environment: <ERROR CLASS>, configure: TestApplicationEngine.Configuration.() -> Unit) : 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
fun TestApplicationEngine(environment: <ERROR CLASS> = createTestEnvironment(), configure: TestApplicationEngine.Configuration.() -> Unit = {})

Types

Link copied to clipboard
class Configuration

An engine configuration for a test application.

Functions

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
fun handleWebSocket(uri: String, setup: TestApplicationRequest.() -> Unit): TestApplicationCall

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)

Installs a hook for test requests.

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

Properties

Link copied to clipboard
var callInterceptor: <ERROR CLASS><Unit, <ERROR CLASS>>
Link copied to clipboard
val client: <ERROR CLASS>
Link copied to clipboard
open override val coroutineContext: CoroutineContext
Link copied to clipboard
val engine: <ERROR CLASS>

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

Extensions

Link copied to clipboard
fun TestApplicationEngine.cookiesSession(callback: () -> Unit)

Keeps cookies between requests inside the callback.

Link copied to clipboard
fun TestApplicationEngine.handleRequest(method: <ERROR CLASS>, uri: String, setup: TestApplicationRequest.() -> Unit = {}): TestApplicationCall

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

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