mathias21 / KtorEasy

Suggested Ktor architecture
GNU General Public License v3.0
260 stars 30 forks source link

How start embeddedServer at Test ? #11

Open CMingTseng opened 2 years ago

CMingTseng commented 2 years ago

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

mathias21 commented 2 years ago

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.