Hello there! I have a question on how to test e2e ...
# ktor
g
Hello there! I have a question on how to test e2e (making rest calls) a ktor+kodein application. The test should be included in the application project. I can explain better with a comparison to spring boot since I'm migrating from it. In Spring Boot I can create a test annotated with
@SpringBootTest
, starting up my application with a real context (no mocks); then using a
TestRestTemplate
I can call my rest api exposed to
<http://localhost>:{springBootRandomPort}
. Does anybody know a similar smart way to test this scenario also for a ktor + kodein app? Unfortunately I wasn't able to find any examples on official documentation.
c
Do they have to be actual REST calls? Ktor has a great
withTestApplication
function that spins up nearly your whole app, but doesn't actually listen on HTTP.
g
Yes, they have to be actual rest calls and my understanding is, as you said, that
withTestApplication
doesn't spin up the whole app, and my goal is to test the whole app listening on HTTP.