2

I am still learning Appium testing with Android app. I am wondering if this is doable.

Let us say I have A.apk and I want to install A.apk to my Android device, then launch the app and try to click through each clickable link (button, help link, image link, etc.) and find out if there is any one is broken.

I don't have access to the source code of A.apk, but I may potentially need to do so to up to 100 other Android apps therefore manually eyeballing each link is quite impossible.

user908645
  • 317
  • 2
  • 3
  • 14

2 Answers2

1

Short answer is : yes, you can.
The amount of efforts to write such tests will depend on how deep you want your tests to be, but you won't need any source of the app even for the most complex scenarios.

Below is more elaborate answer.

You can write blackbox tests relying only on UI elements that the user is supposed to see.
In many cases it is sufficient to identify clickable objects by the text appearing on them.

test snapshot in java:

 // find your button by the text
 WebElement button = driver.findElement(By.name("my button"));
 button.click();
 // you can then wait for the next screen to appear, scroll to element, etc.

 // then you verify that certain text is on screen
 WebElement title = driver.findElement(By.text("some Title"));
 assertNotNull(title);

You can refer to examples and some documentation.

For more sophisticated cases when you don't want/can not rely on just text, you may need to manually identify certain elements using their class (i.e. Button, TextView, EditText), XPath value, unique id string on screen.
You can get all this info by inspecting the app under test (you would need to do it just once before you write your tests) with appium inspector or UI automator viewer.
Again, you won't need anything except the .apk file.

kiruwka
  • 9,250
  • 4
  • 30
  • 41
  • Thanks kiruwka!
    Is that possible to fully black-test an apk, meaning without even running uiautomatorviewer once? For example, I can use Appium to launch the apk. Then use depth-first-search and follow each clickable WebElement, regardless button, textview, view, etc.
    – user908645 Oct 28 '14 at 07:21
  • @user908645 surely you could do that. In my understanding, however, functional UI tests normally carry out same meaning as manual user tests: I.e. after user clicks "Button1" -> he should "see page 2 with text `abc`, etc. – kiruwka Oct 28 '14 at 07:35
0

You don't necessarily need source code to thoroughly test your APK. And as Appium offers great way to test your APKs (no src needed), why not automating that testing with real devices? Emulators unfortunately do not provide good results (no OEM customizations, no real hw, network etc.)

erkz
  • 11
  • 1
  • thanks a lot erkz for the info. yep the reason i choose Appium is that from what i've read about it Appium can be used for black testing of an apk without source code. but all examples i've found requires me to use some sort of identifier, such as resource-id, text, etc. to locate the particular WebElement, via findElements... calls. let us say if i don't have knowledge of xpath, resource-id, text of the apk uses, how can i iterate through all clickable links/buttons on the current page. and further more how to navigate from one activity to another. any sample code helps – user908645 Oct 23 '14 at 04:15