realm-kotlin
realm-kotlin copied to clipboard
Create Test Rule or similar for better management of TestApp lifecycle
In all our integration tests we set up a TestApp for testing App Services functionality. If this test app is not torn down, it will leak dispatchers, which can potentially disrupt other tests.
Currently, we have a TestApp().use { } pattern, but it is annoying code to have littered around in all our tests. It would be much better if we could create something like a JUnit test rule that would automatically clean up.
It would also be nice if such a rule could automatically discover the method being tested since we are manually injecting this ID.
Unfortunately, neither seems to be supported in the Kotlin test framework. So this issue is finding an improvement to the current situation.