アプリのインストルメンテーション テストを作成していて、いくつかのファイルを保存する一時フォルダーを作成したいと考えています。ただし、targetContextではなく、テストコンテキストでそれを行いたくありません。
言い換えると:
// Works, but this creates the folder in the target app.
File dir = getInstrumentation().**getTargetContext()**.getDir("directory", MODE_WORLD_READABLE);
// Does not work, the exists() returns false.
File dir = getInstrumentation().**getContext()**.getDir("directory", MODE_WORLD_READABLE);
私は他のものをたくさん試しましたが、Instrumentation
context
実装がこれらの呼び出しを無視しているように見えますか?
考え?