I am working on an Imaging application. I want to implement unit testing for Bitmap related functions. I also need to see the output Bitmap.
I tried two options :
-
run the test in
test/java
so I can dump the output image to a file on my Mac and open it manually. But I got anandroid.graphics.BitmapFactory not mocked
. -
run the test in
androidTest/java
so BitmapFactory is fully implemented but:- I got
access denied
when trying to pull the file usingadb pull
usingmockContext.openFileOutput(fileName, Context.MODE_PRIVATE)
- I cannot write to an external directory because I cannot grant write access without and Activity using
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
- If I make it work, I don't know how to hook to the gradle task to automate the pull command / or to grand write access at runtime.
- I got
So how to test Bitmap related code ? I am out of options !
Aucun commentaire:
Enregistrer un commentaire