0

I'm trying to pull the path of a screen image I'm looking at on the android phone of the app im testing. The app shows various pictures. I want to pull the path of the picture to pull the picture name, but have no clue how to start. Any guidance?

edit: I'm trying to find out if I could pull the path from the app code to see which image the user is viewing. for example. if im looking at an image, I want to know whats the path of the image (path should be coming from someone's harddrive)

LiLi Liu
  • 37
  • 3
  • 11
  • it's unclear what you are asking for. do you have the source of the application? are you white or black box testing? – Jeffrey Blattman Jun 22 '12 at 22:44
  • srry, I'm trying to automation test scripts using robotium and java for a phone app. I'm trying to find out if I could pull the path from the app code to see which image the user is viewing. – LiLi Liu Jun 22 '12 at 23:36

1 Answers1

0

there's not necessarily a path for an image. it's better to say the source of the image, be it a file, an HTTP stream, or otherwise. and unfortunately, that info is lost once it's set into an ImageView.

to set the image bits into an ImageView, you construct a Bitmap, usually using one of the decode*() methods in BitmapFactory. that is what determines the source of the image. in your unit test framework, you can get a handle to the ImageView by getting the Activity and calling findViewById(), but that's not going to help you.

there may be other places for you to hook into the code to determine that sources for the image data, but i can't say without knowing your application source code.

you could ask your developers to make the source available in the ImageView's tag (see setTag() / getTag()). that way you could pull it out in your unit tests. of course, you'll have to have an understanding with them as to what the source will be (a URL, a database URI, a file path, ?).

Jeffrey Blattman
  • 22,176
  • 9
  • 79
  • 134