0
在測試用例我需要加載的圖片,其可在我testproject的文件夾中加載從res文件夾中的Android測試項目中的文件
/myproject/res/drawable-hdpi/attachment.png
我想它已經使用InstrumentationTestCase和存儲文件在/ res/raw文件夾中並加載它,但R文件不包含我的attachment.png
Context testContext = getInstrumentation().getContext();
InputStream input = testContext.getResources().openRawResource(R.raw.?????????)
任何想法?
感謝
隨着使用資產文件夾而不是,我可以加載它這樣\t \t上下文testContext = getInstrumentation()。getContext(); \t \t InputStream input = testContext.getAssets()。open(「attachment.png」); –