Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared preferences folder not consistent across tests #8765

Open
guillaume-tgl opened this issue Jan 22, 2024 · 0 comments
Open

Shared preferences folder not consistent across tests #8765

guillaume-tgl opened this issue Jan 22, 2024 · 0 comments

Comments

@guillaume-tgl
Copy link

Description

Within the same test class, the shared preferences folder is not always present depending on the different tests within that class.

Steps to Reproduce

@RunWith(RobolectricTestRunner::class)
class SharedPrefsTest {

    @Test
    fun testSharedPrefsFolder() {
        val context: Context = ApplicationProvider.getApplicationContext()
        Assert.assertTrue(File(context.applicationInfo.dataDir, "shared_prefs").exists())
    }

    @Test
    fun testSharedPrefsFolder2() {
        val context: Context = ApplicationProvider.getApplicationContext()
        Assert.assertTrue(File(context.applicationInfo.dataDir, "shared_prefs").exists())
    }
}

Test results:
Screenshot 2024-01-22 at 11 14 53

Robolectric & Android Version

Robolectric 4.11.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant