realm-kotlin icon indicating copy to clipboard operation
realm-kotlin copied to clipboard

Create Test Rule or similar for better management of TestApp lifecycle

Open cmelchior opened this issue 2 years ago • 0 comments

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.

cmelchior avatar Aug 31 '23 18:08 cmelchior