Package io.ktor.client.tests.utils

Types

Link copied to clipboard
expect abstract class ClientLoader(timeoutSeconds: Int)

Helper interface to test client.

actual abstract class ClientLoader(timeoutSeconds: Int)

Helper interface to test client.

actual abstract class ClientLoader(timeoutSeconds: Int)

Helper interface to test client.

actual abstract class ClientLoader(timeoutSeconds: Int)

Helper interface to test client.

Link copied to clipboard
class TestClientBuilder<T : HttpClientEngineConfig>(config: HttpClientConfig<T>.() -> Unit, test: suspend TestInfo.(client: HttpClient) -> Unit, after: suspend (client: HttpClient) -> Unit, repeatCount: Int, dumpAfterDelay: Long, concurrency: Int)
Link copied to clipboard
class TestInfo(threadId: Int, attempt: Int)
Link copied to clipboard
abstract class TestWithKtor

Functions

Link copied to clipboard
fun TestClientBuilder<*>.after(block: suspend (client: HttpClient) -> Unit)
Link copied to clipboard
expect inline fun <T : Throwable> assertFailsAndContainsCause(block: () -> Unit)

Asserts that block completed with given type of root cause.

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

Check that block completed with given type of root cause.

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

Check that block completed with given type of root cause.

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

Check that block completed with given type of root cause.

Link copied to clipboard
expect inline fun <T : Throwable> assertFailsWith(block: () -> Unit)

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

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

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

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

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

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

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

Link copied to clipboard
fun <T : HttpClientEngineConfig> TestClientBuilder<T>.config(block: HttpClientConfig<T>.() -> Unit)
Link copied to clipboard
fun makeArray(size: Int): ByteArray
Link copied to clipboard
fun List<PartData>.makeString(): String
fun makeString(size: Int): String
Link copied to clipboard
fun TestClientBuilder<*>.test(block: suspend TestInfo.(client: HttpClient) -> Unit)
Link copied to clipboard
fun testWithEngine(engine: HttpClientEngine, timeoutMillis: Long = 60 * 1000L, block: suspend TestClientBuilder<*>.() -> Unit)

Perform test with selected client engine.

fun <T : HttpClientEngineConfig> testWithEngine(factory: HttpClientEngineFactory<T>, loader: ClientLoader? = null, timeoutMillis: Long = 60L * 1000L, block: suspend TestClientBuilder<T>.() -> Unit)

Perform test with selected client engine factory.

Properties

Link copied to clipboard
const val TCP_SERVER: String

Proxy server url for tests.

Link copied to clipboard
const val TEST_SERVER: String

Web url for tests.

Link copied to clipboard
const val TEST_WEBSOCKET_SERVER: String

Websocket server url for tests.