KtorEasy icon indicating copy to clipboard operation
KtorEasy copied to clipboard

How start embeddedServer at Test ?

Open CMingTseng opened this issue 2 years ago • 1 comments

Dear Sir

very thx your post https://medium.com/@math21/testing-a-ktor-server-part-i-route-testing-84f8e82454d7 & demo

i have QA

as the code
https://github.com/mathias21/KtorEasy/blob/06568a65d994cd1977592119b2cc537ac7d377e7/src/Application.kt#L30

i can start a ktor server at normal mode ( src)

i look the test sourceSet

you craete a test demo https://github.com/mathias21/KtorEasy/blob/06568a65d994cd1977592119b2cc537ac7d377e7/test/ApplicationTest.kt#L10

if i export " embeddedServer(Netty, port = config.port) {...}" as a class (Yes i want run ktor serve at Andorid or other JVM like)

how let us test this class at Test mode ? or how start embeddedServer at Test ?

THX

CMingTseng avatar Oct 16 '22 17:10 CMingTseng

ApplicationTest is under comments, so nothing really to see there. There are plenty of resources around where to look for the question you are mentioning here, for example: https://ktor.io/docs/testing.html#configure-test-app

I don't think having that part covered in this repository will help anyone. So I would recommend you to check the previous link. I hope this can help you.

mathias21 avatar Oct 18 '22 07:10 mathias21