Skip to content

Make KoinListener work with property based testing #2171

@headsvk

Description

@headsvk

I took me some debugging to find out why my property tests with Koin fail.
I expected KoinListener would reset Koin after each test, no matter if it's a basic test or a property test.

Then I found out that the second run of my simple test reuses the values saved in Koin from the first run.

checkAll<Boolean> { arg -> // true/false
  declareMock {
      Repository(arg)
  }
  get<Service>() // always Repository(true)
}

I understand I have to implement Koin support with PropTestListener on top of the KoinListener to get it to work as I expect?
Can we get KoinPropTestListener as a library extension?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement ✨Suggestions for adding new features or improving existing ones.extensions 🔋Related to the extensions mechanisms within the testing frameworkgood-first-issue 👶Suitable for newcomers looking to contribute to the project.pinned 📌Issues of high importance or that need to remain visible.property-testing 📏Related to the property testing mechanisms within the testing framework.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions