andylamax
02/17/2022, 10:55 PMBig Chungus
02/17/2022, 11:07 PMandylamax
02/18/2022, 5:15 AMephemient
02/18/2022, 8:13 AMephemient
02/18/2022, 8:15 AMandylamax
02/18/2022, 10:49 AMandylamax
02/20/2022, 1:21 AMinterface MonitorApi
(currently targeting android,jvm,browser and nodejs. With potential of expanding to ios) with two concrete implementations
• class MonitorApiMock : MonitorApi
• class MonitorApiKtor : MonitorApi
At the moment, I have a large set of tests that use the MonitorApiMock
implementation. I need to be able to run the same tests with MonitorApiKtor
but this now needs a running server instance, because it actually make http calls to the said server.
Approach
Initially, I used test containers and they seem to work flawlessly but only for jvm. So I abandoned ship to the second approach
I have been testing manually by starting the server and giving gradle some environment variable (e.g. API=KTOR ./gradlew allTests
)
In the Jvm
and NodeJs
I can easily read this environment variable and decide which implementation to use at runtime. However this fails me in browser.
Possible Suggestions?
I need a way I can inject this environment variable in a test environment and decide it at runtime as well
or
I am willing to write a testcontainers
equivalent (looks like the suitable desired outcome) that works for MPP. I don't how (yet), but I don't see how a gradle build service would be the tool I need for now.
Any solid pointers would be heavily appreciatedturansky
02/20/2022, 1:26 AMturansky
02/20/2022, 1:38 AMVampire
02/20/2022, 1:39 AMMatthias Geisler
02/20/2022, 1:47 AMandylamax
02/20/2022, 1:54 AMkfc-plugins
to achieve injection of env variables into kotlinjsandylamax
02/20/2022, 1:56 AMandylamax
02/20/2022, 1:59 AMMatthias Geisler
02/20/2022, 2:17 AMandylamax
02/20/2022, 3:08 AM