Testing the service
To write our first test, let's create a new file called ServerTest.kt
under the src/test/kotlin
directory.
Now, let's add a new dependency:
dependencies { ... testImplementation("io.ktor:ktor-server- tests:$ktorVersion") }
Next, let's add the following contents to our ServerTest.kt
file:
internal class ServerTest { @Test fun testStatus() { withTestApplication { val response = handleRequest(HttpMethod.Get, "/status").response assertEquals(HttpStatusCode.OK, ...