Annyce Davis

Davis Technology Consulting

  • Home
  • About Me
  • Blog
  • Courses
  • Newsletter

Testing Tricks #2: Finding UI Views

December 7, 2015 by Annyce Davis

When you’re writing Espresso tests for your Android applications, you will often need to reference the resource id of a particular view in order to make your assertions. Instead of digging through code you can take advantage of the UIAutomatorViewer tool. It’s very simple to use and helps you to visualize the hierarchy of the views in your application. 


Here it is in action:

Espresso Test

@Test
public void clickOnDetailItemShouldDisplayPlayer() {
    onView(withId(R.id.container_list)).check(matches(isDisplayed()));
    onView(withId(R.id.browse_headers))
        .perform(pressKey(KeyEvent.KEYCODE_DPAD_RIGHT));

    onView(allOf(isDescendantOfA(
                     withRecyclerView(R.id.row_content).atPosition(0)),
           withId(R.id.info_field)))
              .perform(pressKey(KeyEvent.KEYCODE_DPAD_CENTER));

    onView(withId(R.id.wapo_player_view))
        .check(matches(isDisplayed()));
}
 
This test is for an AndroidTV application. It makes sure that the D-Pad navigation from the main header to the nested RecyclerView is functioning as expected. All of the ids for the views were found using uiautomatorviewer.


Hope you found this useful, until next time!

Testing Your Apps with AWS Device Farm

August 12, 2015 by Annyce Davis

Recently, I’ve been on a mission to enhance the quality of the tests in the Android applications that I work on.  To that end, I was introduced to the AWS Device Farm, a cloud based app testing platform.

It was very simple to set up and like most AWS products comes with free tier usage. You move through five steps (at most) and then your app will be tested on the devices you choose.  To get an idea of how it works, just follow the screenshots below.

1. Choose Your Application

2. Configure a test

3. Select Devices

Then you are presented with some additional device configuration options (bluetooth, NFC, GPS, etc.). Finally, you have the ability to review and submit your run configuration. Once all of the devices have completed running your tests you can then drill down and view the individual results of each test.

Test Results


If you try it out, leave me your thoughts below.

Android Testing, Why So Hard?! – Talk

April 13, 2015 by Annyce Davis

Android devices come in all shapes and sizes, with varying performance levels and APIs. This is one of the reasons that writing tests for Android applications can be so daunting, let alone the seemingly endless number of tools available to write those tests. This presentation discusses three simple steps to get started with writing tests for your Android applications.

Slides

Resources

  • List of Testing Articles/Videos: http://git.io/h6HQ
  • Fragmented Podcast: Episode #1
  • Android Workflow Guides: http://git.io/h67r
  • Genymotion Emulator: https://www.genymotion.com

Various Android Testing Frameworks

April 8, 2015 by Annyce Davis

Various Options for Android Testing

I’ve been researching the tools and frameworks that are out there when it comes to testing Android Applications.  I’ve started a repository on GitHub with some of the best articles and videos I’ve found so far. Check it out here => http://git.io/h6HQ.

« Previous Page
Next Page »

Follow Me

  • Bluesky

Categories

  • Android (61)
  • Career (5)
  • Communication (4)
  • Flutter (1)
  • Git (4)
  • Gradle (4)
  • Grails (23)
  • iOS (1)
  • Java (8)
  • JavaScript (6)
  • Kotlin (17)
  • Life (5)
  • Public Speaking (26)
  • Revenue (2)
  • RxJava (1)
  • Software Development (14)
  • Twitter (3)
  • Uncategorized (11)
  • Video Course (5)

Follow Me

  • Bluesky

Copyright © 2025 · All Rights Reserved · Log in