androidappiumblack-box-testing

Use Appium to black-test Android app


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.


Solution

  • 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.