Giter Site home page Giter Site logo

Comments (6)

javiercamarenatriguero avatar javiercamarenatriguero commented on June 14, 2024 1

Thanks @arnaudgiuliani ! Sure, The issue just affects when the koin-androidx-compose is upgraded from v3.5.0 -> v3.5.3/4. The code contains some Automation Test in Espresso, and for some reason the second Test Case of the same Test Class fails when the ViewModelFactory tries to get the instance of the ViewModel. In order to provide more information, this is the KoinTestRule used on the Test Class (based on tutorials):

class KoinTestRule(
    private val modules: List<Module> = emptyList()
) : TestWatcher() {

    private val modulesByDefault = listOf(dataModule, useCaseModule, viewModelModule, appModule)
    override fun starting(description: Description) {
        startKoin {
            androidContext(InstrumentationRegistry.getInstrumentation().targetContext.applicationContext)
            modules(modulesByDefault + modules)
        }
    }

    override fun finished(description: Description) {
        stopKoin()
    }
}

And this is the invocation on the Test Class:

private val instrumentedTestModule = module {
        factory { getMockDataLocalSource() }
        factory { getMockQuestions(questionJson) }
        ...
    }

    override val koinTestRule: KoinTestRule
        get() = KoinTestRule(
            modules = listOf(instrumentedTestModule)
        )

The first TestCase works fine, but the second one fails on this. It happens to all the Test Classes. It was working fine until now. Thanks in advance

from koin.

arnaudgiuliani avatar arnaudgiuliani commented on June 14, 2024

Can you detail it a bit more?

from koin.

kasim-canol-sz avatar kasim-canol-sz commented on June 14, 2024

@arnaudgiuliani Do you have any updates regarding this issue? Our tests are also affected by the same issue, therefore we're currently not able to update the koin version.

from koin.

javiercamarenatriguero avatar javiercamarenatriguero commented on June 14, 2024

Hi @arnaudgiuliani, any update about this issue? Thanks in advance

from koin.

arnaudgiuliani avatar arnaudgiuliani commented on June 14, 2024

weird, seems that VM factory is invoked after scope closing 🤔

from koin.

arnaudgiuliani avatar arnaudgiuliani commented on June 14, 2024

can anyone help by providing a test project for that? @kasim-canol-sz @javiercamarenatriguero

from koin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.