I want to create text file with output on my laptop(not on Android emulator).
I use this code but it's doesn't work for me:
@Test
fun useAppContext() {
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
val str = "OUTPUT"
val outputStreamWriter =
OutputStreamWriter(appContext.openFileOutput("output.json", Context.MODE_PRIVATE))
outputStreamWriter.write(str)
outputStreamWriter.close()
}
How to write to file on my computer from Android Instrumented tests? (I know that is possible)