ApplicationTestBuilder

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Returns an instance of Application used in this test. This application might be not started if used before startApplication was called, or any client request was made.

Link copied to clipboard
open override var client: HttpClient

Returns the current client attached to the test application instance.

Functions

Link copied to clipboard
fun application(block: suspend Application.() -> Unit)

Adds a module to TestApplication.

Link copied to clipboard
fun configure(vararg configPaths: String, overrides: MutableMap<String, String>.() -> Unit? = null)

Configures the application environment using the provided configuration file paths.

Link copied to clipboard

Creates a client with a custom configuration. For example, to send JSON data in a test POST/PUT request, you can install the ContentNegotiation plugin:

Link copied to clipboard

Adds a configuration block for the TestApplicationEngine.

Link copied to clipboard

Builds an environment using block.

Link copied to clipboard

Builds mocks for external services using ExternalServicesBuilder.

Link copied to clipboard
fun <P : Pipeline<*, PipelineCall>, B : Any, F : Any> install(plugin: Plugin<P, B, F>, configure: B.() -> Unit = {})

Installs a plugin into TestApplication

Link copied to clipboard
fun routing(configuration: Route.() -> Unit)

Installs routing into TestApplication

Link copied to clipboard

Adds a configuration block for the ServerConfig.

Link copied to clipboard
suspend fun startApplication()

Starts instance of TestApplication. Usually, users do not need to call this method because application will start on the first client call. But it's still useful when you need to test your application lifecycle events.