Package io.ktor.client.tests.utils

Types

ClientLoader

abstract expect class ClientLoader

Helper interface to test client.

TestClientBuilder

class TestClientBuilder<T : HttpClientEngineConfig>

TestInfo

class TestInfo

TestWithKtor

abstract class TestWithKtor

Extensions for External Classes

kotlin.collections.List

Properties

HTTP_PROXY_SERVER

const val HTTP_PROXY_SERVER: String

Proxy server url for tests.

TEST_SERVER

const val TEST_SERVER: String

Web url for tests.

TEST_WEBSOCKET_SERVER

const val TEST_WEBSOCKET_SERVER: String

Websocket server url for tests.

Functions

after

fun TestClientBuilder<*>.after(
    block: suspend (client: HttpClient) -> Unit
): Unit

assertFailsAndContainsCause

expect fun <T : Throwable> assertFailsAndContainsCause(
    block: () -> Unit
): Unit

Asserts that block completed with given type of root cause.

assertFailsWith

expect fun <T : Throwable> assertFailsWith(
    block: () -> Unit
): Unit

Asserts that a block fails with a specific exception of type T being thrown.

config

fun <T : HttpClientEngineConfig> TestClientBuilder<T>.config(
    block: HttpClientConfig<T>.() -> Unit
): Unit

main

fun main(): Unit

Start server for tests.

makeArray

fun makeArray(size: Int): ByteArray

makeString

fun makeString(size: Int): String

test

fun TestClientBuilder<*>.test(
    block: suspend TestInfo.(client: HttpClient) -> Unit
): Unit

testWithEngine

fun testWithEngine(
    engine: HttpClientEngine,
    block: suspend TestClientBuilder<*>.() -> Unit
): Unit

Perform test with selected client engine.

fun <T : HttpClientEngineConfig> testWithEngine(
    factory: HttpClientEngineFactory<T>,
    loader: ClientLoader? = null,
    block: suspend TestClientBuilder<T>.() -> Unit
): Unit

Perform test with selected client engine factory.