Leem.fin
Leem.fin

Reputation: 42692

Create file in JUnit test case in Android

I am developing my test project to unit test my Android project.

In my test case, I would like to create a file in my computer e.g. under /Users/MyUserName/Documents/ & write some test result into this file. Is it possible?? How to do it??

protected void setUp() throws Exception {
        super.setUp();

        File myTestResult = CREATE_FILE_IN_MY_COMPUTER();

}

Upvotes: 0

Views: 686

Answers (1)

dmon
dmon

Reputation: 30168

Nope. Not like that at least. All test code runs within the phone/emulator and as such has no direct access to your computer's file system.

You'd probably have to write a webservice that runs in your machine to which your tests send data via HTTP or similar.

More importantly, what are you trying to achieve?

Upvotes: 1

Related Questions