android:如何在不执行应用代码的情况下测试是否存在文件的小代码

时间:2020-06-16 05:19:54

标签: android unit-testing

我需要在Android应用中测试文件是否存在

代码为:

String filepath="/somefilepath_on_my_android_device"
File file = new File(filePath);
if(file.exists())      
//Do something
else
// Do something else.

但是我在一个项目的中间。在执行之前,我只想测试它的工作原理

我对单元测试完全陌生

我已经阅读了两种测试

1) Local unit tests and
2) Instrumented tests:

那我必须使用哪一个。

0 个答案:

没有答案
相关问题