Hi folks
I have multiple junit tests based on koin
Any idea how I could easily run tests in parallel?
Looks like koin has a global context, and tests are not isolated (changing the junit config, I got errors like "koin already started")
w
withoutclass
07/24/2025, 1:43 PM
probably context isolation
withoutclass
07/24/2025, 1:43 PM
but unsure since I’ve not run into this specific scenario
a
arnaud.giuliani
07/24/2025, 2:11 PM
yes, using
koinApplication
instead of
startKoin
is making local context instead of global one. Depends your usage behind
l
Laurent Thiebaud
07/28/2025, 1:06 PM
I want to use it for tests, however that doesn't work because :
• in tests I create a
koinApplication
with my modules
• then I declare some mocks on top within it
• I also declare the
KoinComponent
I want to test
• in the
KoinComponent
I get other dependencies using by
inject<OtherDep>()
=> injection fails because
KoinApplication has not been started
it looks like within a
koinApplication
,
inject
resolves dependencies using the global context
Do I understand well? Is that expected? It doesn't sound logical