Skip to content
A basic Appium framework for an Android app using PageObject, PageFactory, TestNG, Hamcrest
Branch: master
Clone or download
Latest commit 6ee182f Jun 7, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
ApiDemos-debug.apk Basic Framework May 14, 2017 Update Jun 7, 2017
build.gradle Basic Framework May 14, 2017
gradlew Basic Framework May 14, 2017
gradlew.bat Basic Framework May 14, 2017
settings.gradle Basic Framework May 14, 2017



  • A basic Appium framework for an Android app using Appium, Java, Gradle, the PageObject pattern, PageFactory, TestNG, Hamcrest

App Under Test

  • We are using the ApiDemos-debug.apk sample app included on Appium's GitHub repository.

ApiDemos-debug Home Page

alt text

The Test Outline

  • Appium, using the Desired Capabilities will install and launch the app @BeforeSuite.
  • We will wait for the header to appear on the HomeScreen page.
  • Select the “Text” button then Wait for the header on the InnerApiDemos page to appear.
  • Select “LogTextBox”. Wait for the header on the LogTextBox page to appear.
  • Select the ADD button. In the panel below the ADD button, the text "This is a test" should display in the panel.
  • Assert that the words “This is a test” appears in the panel.
  • After the test is run, we will tear down the driver.


  • Appium must be running on your local computer, such as with Appium Desktop
  • An emulator must be connected via adb, the Android Debug Bridge, called emulator-5554

Directory Structure:

-> test
   -> java
      --> pages
      --> utils 

The Smoketest

    public void test_login() throws Exception {
        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);




        String expectedPanelText = "This is a test";
        String actualPanelText = logTextBoxPage.getPanelText();

        System.out.println("Checking panel text...");

        TestUtils.outputIfMatchPassOrFail(expectedPanelText, actualPanelText);

Output Rendered After Running Automated Test

HOME_SCREEN_PAGE: Verifying Header appears.
HOME_SCREEN_PAGE: Selecting [TEXT] button.

INNER_API_DEMOS_PAGE: Verifying Header appears.
INNER_API_DEMOS_PAGE: Selecting [LogTextBox] button.

LOG_TEXT_BOX_PAGE: Verifying Header appears.
LOG_TEXT_BOX_PAGE: Selecting [ADD] button.

Checking panel text...
Verifying Expected Value Matches Actual Value:
	* Expected Value: This is a test
	* Actual Value: This is a test

===> (PASS)

Tearing Down Driver.

Setup and Code Walkthrough on Building a Basic Appium Framework

Future plans

Other Appium frameworks, modeled on this code, will include:

  • Appium will be started and stopped programatically.
  • We will use abstract classes BaseTest and BasePage, refactoring common elements out. Tests and Pages will be extensions of these BaseTests and BasePages.
  • iPads, iPhones, both physical devices and emulators
  • Multiple mobile devices running tests simulatneously and in parrallel
  • Better logs
You can’t perform that action at this time.