The Screen Design pattern is the same pattern to mobile applications as the Page Object creation pattern is to web application testing.

The Screen Design pattern uses a software object to interact with the mobile screen visible to the user. Other objects use it in testing use cases.

Benefits:

  • Easy maintenance and refactoring
  • Less time and cost than other methods (play-and-record, etc.) for creating and maintaining test code
  • Extendable features and separation of implementation class to drive the tests
  • Allows for elegant, smart, object-oriented design and make testing entirely data-driven (ie, drive many test cases without needing to do any programming)

The orange lines connecting the layers indicate which layers are interacted with by the other layers.


Let's get started!

Step 1 - Install (if needed) the required software to run the example

  • Java for iOS
  • Apache Ant (latest version)
  • Android Studio (latest version) with all Android SDK's downloaded from v.17-20)
  • Node.js (install using Brew and not the UI version that requires admin password)
  • Appium - v1.0 - Install Inspector and command-line tools
  • Make sure all of these executable are in your $PATH variable

Step 2 - Download the SQAEvangelist open-source automated testing framework (Java-based) and compile

Step 3 - Download the mobile and test applications

Step 4 - Configure and Run

  • In the official_android/SQAEvangelistTestAppTest/tests/conf/webdriverconfiguration.properties, edit this line to your
    SQAEvagelistTestApp.app
    location on your local system. Example:
      app_location=/Users/michael/SQAEvangelist/official_android/SQAEvangelist/app/build/apk/app-debug-unaligned.apk
  • Open a terminal/command prompt window and "cd" to the directory: official_android/SQAEvangelistTestAppTest/tests
  • Type:
    ant

Step 5 - Watch the tests run and be happy!

  • Example screen shot of the example mobile app being displayed in the AVD emulator.

  • Example screen shot of a successful login: positive test case

  • Example output from ant and display perfect test results :)