1 of 29

RBCN22

#ROBOCON2022

MAY 2022

2 of 29

Getting Started With The Robotframework-AppiumLibrary

:: RoboCon In-person Workshop Presented By ::

Joshua Gorospe

QA Tech Lead

Secureworks https://www.secureworks.com/

Linkedin Profile https://www.linkedin.com/in/joshua8481/

Twitter Profile https://twitter.com/8481jg

https://robocon.io

2

RBCN22

MAY 2022

3 of 29

Before We Begin...

I want to thank the following people and groups.

- Pekka Klarck

- Ed Manlove

- Serhat Bolsu

- Antti Karjalainen

- René Rohner

- James Bach

- Jonathan Bach

- Michael Bolton

- Cem Kaner

- Kristian Karl

- Harry Robinson

- Mikko Korpela

- Bryan Oakley

- Shiva Prasad Adirala

- The Appium development team

- The Graphwalker development team

- The thought-leaders who inspired me to learn model-based testing

- The thought-leaders of Rapid Software Testing Methodology

- The entire Robot Framework community and its contributors

https://robocon.io

3

MAY 2022

4 of 29

FYI Windows Users

The Robotframework-AppiumLibrary examples in this workshop use a lot of Bash scripting. Here are some possible options that may help you, but I have not tested them myself...

https://robocon.io

4

MAY 2022

5 of 29

Introduction And Workshop Outline

This will be a very hands on Workshop covering Robotframework-AppiumLibrary combined with various tools. I will be using an updated version of the same workshop material from RoboCon 2021, but it will have exclusive examples that can only be experienced in-person here in RoboCon 2022. I will be frequently moving back and forth between slides and running the examples from a terminal. From a high-level, the following Workshop areas will be covered in two parts.

  • Part One
    • Technical requirements summary.
    • Appium installation advice and mobile device Emulator/Simulator setup guidance.
    • App automation workflows for IOS, and Android (including adb shell).
    • Browser automation workflows for Safari on IOS and Chrome on Android.�
  • Part Two
    • Appium Desktop walkthrough, and useful features for Robot Framework users.
    • Charles Proxy combined with Robotframework-AppiumLibrary.
    • PaBot running IOS + Android simultaneously, combined with Graphwalker, and Android Emulator CPU monitoring.

5

MAY 2022

6 of 29

Part One: Technical Requirements Summary

The following are needed to run the Workshop Examples. Please follow instructions on each website to install them.��

- Python 3, this workshop was created using version 3.9.2 -> https://www.python.org/downloads/��

- NodeJS 14, this workshop was created using version 14.16.0 -> https://nodejs.org/en/ or https://github.com/nvm-sh/nvm��

- Java 11, this workshop was created using version 11.0.10 -> https://www.java.com/en/��

- Appium Server -> http://appium.io/docs/en/about-appium/getting-started/?lang=en#getting-started

- Android Studio -> https://developer.android.com/studio

- XCode, only available for MacOS users -> https://developer.apple.com/xcode/

- Robot Framework and Robotframework-AppiumLibrary -> https://robotframework.org

- PaBot -> https://github.com/mkorpela/pabot

- Charles Proxy -> https://www.charlesproxy.com/documentation/proxying

- Graphwalker -> https://github.com/GraphWalker/graphwalker-project

- Appium Desktop -> https://github.com/appium/appium-desktop

- wget -> https://www.gnu.org/software/wget/

- cURL -> https://curl.se/

- jq https://stedolan.github.io/jq/

- git https://git-scm.com/

https://robocon.io

6

MAY 2022

7 of 29

Part One: Technical Requirements Summary

Run the following commands to get the Workshop Examples (requires git).

https://robocon.io

7

MAY 2022

8 of 29

Part One: Appium Installation Advice, Android Emulator, IOS Simulator Setups

Please make sure you have reviewed all of the items in the Technical Requirements Summary slides.

  • The rest of this Part One section assumes you have installed all of the basics.
  • Basic requirements for this Workshop are NodeJS 14, Python 3, and Java 11
    • I recommend NVM (https://github.com/nvm-sh/nvm) for NodeJS installation.
    • Installing anything with Homebrew (https://brew.sh/) may fail sometimes, for example this happened after I installed the MacOS Big Sur update.

Based on the Appium “Getting Started” instructions kept here -> http://appium.io/docs/en/about-appium/getting-started/index.html, you should be able to run the following commands successfully without issues.

  • Install Appium Server -> npm install -g appium
  • Install appium-doctor -> npm install -g appium-doctor
  • Run appium-doctor...

https://robocon.io

8

MAY 2022

9 of 29

Part One: Appium Installation Advice, Android Emulator, IOS Simulator Setups

From a Windows operating system the appium-doctor output should look similar to this.

https://robocon.io

9

MAY 2022

10 of 29

Part One: Appium Installation Advice, Android Emulator, IOS Simulator Setups

From a Linux (Ubuntu) operating system the appium-doctor output should look similar to this.

https://robocon.io

10

MAY 2022

11 of 29

Part One: Appium Installation Advice, Android Emulator, IOS Simulator Setups

Pay attention to any red “X” output. Follow all of the instructions provided by appium-doctor.

https://robocon.io

11

MAY 2022

12 of 29

Part One: Appium Installation Advice, Android Emulator, IOS Simulator Setups

After following all of the instructions, all of the appium-doctor output should eventually show green check marks. This is a MacOS example.

https://robocon.io

12

MAY 2022

13 of 29

Part One: Appium Installation Advice, Android Emulator, IOS Simulator Setups

Steps for setting up your Android Emulator.

  • Start Android Studio.
  • Click on the “Configure” button, and select AVD Manager.

https://robocon.io

13

MAY 2022

14 of 29

Part One: Appium Installation Advice, Android Emulator, IOS Simulator Setup

Steps for setting up your Android Emulator.

  • From “AVD Manager”, click on the “Create Virtual Device” button.
  • The “Virtual Device Configuration” will appear, select all of the options you need for your device.

https://robocon.io

14

MAY 2022

15 of 29

Part One: Appium Installation Advice, Android Emulator, IOS Simulator Setups

Steps for setting up your Android Emulator.

  • Click the “Finish” button from “Virtual Device Configuration”.
  • Your new device should appear on the “AVD Manager” list.

https://robocon.io

15

MAY 2022

16 of 29

Part One: Appium Installation Advice, Android Emulator, IOS Simulator Setups

Steps for setting up your Android Emulator.

  • Go to the root of the Getting-Started-Robotframework-AppiumLibrary-RoboCon-2021 repo.
  • Open the start-specific-appium-example-workflows-for-workshop.sh file in an editor.
  • Change the following (two places in the Bash script) to match the Android device that you have just set up...or...
  • Workshop demonstrations are using a Nexus 5 API 27. You can also set up the same Android device.

https://robocon.io

16

MAY 2022

17 of 29

Part One: Appium Installation Advice, Android Emulator, IOS Simulator Setups

Steps for setting up your IOS Simulator.

  • Installing XCode on your Mac machine will automatically install IOS Simulators for you.
  • To check your available IOS Simulators, run this command -> xcrun simctl list
  • Workshop demonstrations are using an iPad Pro (12.9-inch) (5th generation). Check it in your list.

https://robocon.io

17

MAY 2022

18 of 29

Part One: Appium Installation Advice, Android Emulator, IOS Simulator Setups

Steps for setting up your IOS Simulator.

  • XCode can also automatically check for new IOS updates by going to “Preferences”, then “Components”
  • You can enable the automatic update checkbox, or you can click “Check and Install Now.
  • I installed iOS 13.7 and 14.4, which has iPad Pro (12.9-inch) (5th generation) in the xcrun simctl list output (previous slide).

https://robocon.io

18

MAY 2022

19 of 29

Questions About Part One (installation, device setup, etc.)?

https://robocon.io

19

MAY 2022

20 of 29

Part One: App automation workflows for IOS, and Android + adb shell

From your terminal or command-line.

  • Go to the root of the Getting-Started-Robotframework-AppiumLibrary-RoboCon-2021 repo.
  • Run the following commands first before running any of the examples for Part One.
    • bash ./start-specific-appium-example-workflows-for-workshop.sh All-Appium-Tests-Teardown &&
    • bash ./start-specific-appium-example-workflows-for-workshop.sh Appium-No-Proxy-Test-Setup

After the teardown and setup scripts successfully completed, you should see the Android device that was set up earlier appear on the screen.

  • The following will install and run simple Wikipedia app tests on an iOS Simulator.
  • bash ./start-specific-appium-example-workflows-for-workshop.sh Robot-Framework-IOS-App-Tests

https://robocon.io

20

MAY 2022

21 of 29

Part One: App automation workflows for IOS, and Android + adb shell

The following will install and run simple Wikipedia app tests on an Android device.

  • This example will also create a video recording.
    • bash ./start-specific-appium-example-workflows-for-workshop.sh Robot-Framework-Android-Apps-And-Adb-Tests Android_App_Recording_Screen_Capture

The following will run various adb shell commands and native Calculator app tests on an Android device. The commands below come from this comprehensive and useful GitHub list -> https://gist.github.com/Pulimet/5013acf2cd5b28e55036c82c91bd56d8

  • This example will check the status of a specific Android app process that is active
    • bash ./start-specific-appium-example-workflows-for-workshop.sh Robot-Framework-Android-Apps-And-Adb-Tests Android_Adb_PS_Command
  • This example will check the file system contents for the current directory on the Android device.
    • bash ./start-specific-appium-example-workflows-for-workshop.sh Robot-Framework-Android-Apps-And-Adb-Tests Android_Adb_LS_Command
  • This example will check that a specific package is installed on the Android device.
    • bash ./start-specific-appium-example-workflows-for-workshop.sh Robot-Framework-Android-Apps-And-Adb-Tests Android_Adb_Dumpsys_Grep_Command
  • This example will check detailed information on all installed packages.
    • bash ./start-specific-appium-example-workflows-for-workshop.sh Robot-Framework-Android-Apps-And-Adb-Tests Android_Adb_Dumpsys_Package_Command
  • This example will check a list of feature information about the Android device.
    • bash ./start-specific-appium-example-workflows-for-workshop.sh Robot-Framework-Android-Apps-And-Adb-Tests Android_Adb_PM_List_Command
  • This example will check the current version of Android OS on the device.
    • bash ./start-specific-appium-example-workflows-for-workshop.sh Robot-Framework-Android-Apps-And-Adb-Tests Android_Adb_Build_Version_Command

https://robocon.io

21

MAY 2022

22 of 29

Part One: App automation workflows for IOS, and Android + adb shell

The following will run various adb shell commands and native Calculator app tests on an Android device. The commands below come from this comprehensive and useful GitHub list -> https://gist.github.com/Pulimet/5013acf2cd5b28e55036c82c91bd56d8

  • This example will check netstat (network statistics) for TCP connections going through the device.
    • bash ./start-specific-appium-example-workflows-for-workshop.sh Robot-Framework-Android-Apps-And-Adb-Tests Android_Adb_Netstat_Command
  • This example will display the contacts list.
    • bash ./start-specific-appium-example-workflows-for-workshop.sh Robot-Framework-Android-Apps-And-Adb-Tests Android_Adb_Contacts_List_Command
  • This example will to start and end a phone call on the device.
    • bash ./start-specific-appium-example-workflows-for-workshop.sh Robot-Framework-Android-Apps-And-Adb-Tests Android_Adb_Phone_Call_Command
  • This example will prepare a text message from the device.
    • bash ./start-specific-appium-example-workflows-for-workshop.sh Robot-Framework-Android-Apps-And-Adb-Tests Android_Adb_Text_Message_Command
  • This example will run logcat to collect the device's system logs in a file.
    • bash ./start-specific-appium-example-workflows-for-workshop.sh Robot-Framework-Android-Apps-And-Adb-Tests Android_Adb_Logcat_Command
  • This example will run bugreport to collect the device's system logs, stack traces, and other helpful diagnostic data.
    • bash ./start-specific-appium-example-workflows-for-workshop.sh Robot-Framework-Android-Apps-And-Adb-Tests Android_Adb_Bugreport_Command

https://robocon.io

22

MAY 2022

23 of 29

Part One: Browser automation for IOS and Android

The following will run Safari and Chrome browser automation examples.

  • bash ./start-specific-appium-example-workflows-for-workshop.sh Robot-Framework-IOS-And-Android-Mobile-Browsers-Test-Examples

https://robocon.io

23

MAY 2022

24 of 29

Questions About Part One (examples etc.)?

https://robocon.io

24

MAY 2022

25 of 29

Part Two: Appium Desktop Walkthrough

There are useful Appium Desktop features that can assist you while you are building out your automation.�

  • Provides a convenient GUI for Appium Server and easy access to the following.
    • Capability sets
    • Connection options for mobile automation Cloud providers

  • Appium Inspector -> gathers details about the UI elements of your app.

  • Inspector Recording option generates Appium automation code in Javascript, Python, Ruby, Java, and Robot Framework

https://robocon.io

25

MAY 2022

26 of 29

Part Two: Charles Proxy Combined With Robotframework-AppiumLibrary

Charles Proxy is a popular, well documented, and very useful web debugging proxy. It is not free software and requires a license key, but it’s very affordable. It has a large list of builtin tools and features.

The key features that we will be exploring in this Workshop are the following.

  • Headless automation of Charles Proxy from its command-line tools.
  • Capturing and recording all HTTP traffic going into any connected mobile device (real or Emulator/Simulator).

The following example commands requires a properly configured charles.config file, a generic file is provided in the Workshop repo. More information can be found here by searching for “charles.config” -> https://github.com/jg8481/Tool-Strategies-Lone-Testers-Test-Leadership-Congress-2019#ongoing-work

  • bash ./start-specific-appium-example-workflows-for-workshop.sh All-Appium-Tests-Teardown &&
  • bash ./start-specific-appium-example-workflows-for-workshop.sh Appium-Charles-Proxy-Test-Setup &&
  • bash ./start-specific-appium-example-workflows-for-workshop.sh Robot-Framework-Charles-Proxy-IOS-And-Android-Mobile-Browsers-Test-Example

https://robocon.io

26

MAY 2022

27 of 29

Part Two: PaBot, Appium, And Graphwalker Combined With CPU Monitoring

The following examples will run an IOS and Android device in parallel using PaBot, a Robot Framework parallel test runner -> https://github.com/mkorpela/pabot

  • On the IOS device, PaBot + Robotframework-AppiumLibrary will run the Wikipedia app in a loop.
  • On the Android device PaBot + Robotframework-AppiumLibrary will run two types of tests in parallel.
    • Android Calculator app will be automated with a Model Based Testing approach that uses Graphwalker to generate different sequences of keywords based on a graph.
    • While the Android Graphwalker test is running, PaBot will monitor CPU usage using adb shell and Linux top command.

This command will run the PaBot automation.

  • bash ./start-specific-appium-example-workflows-for-workshop.sh Robot-Framework-Parallel-IOS-Android-Tests

Side Note: This same PaBot Android + Grahpwalker + adb shell CPU monitoring parallel running test can also be performed on a real Android device.

  • Take your real Android device and enable the “Developer Options” by following the Android developers website instructions found here -> https://developer.android.com/studio/debug/dev-options
  • Enable the “USB debugging” option in the Developer Options menu
  • Plug in your device and run the “adb device” command from a terminal, then copy the alpha-numeric device name from adb into your DEVICE_NAME_ANDROID1” environment variable in your .env file

https://robocon.io

27

MAY 2022

28 of 29

Questions About Part Two (examples etc.)?

https://robocon.io

28

MAY 2022

29 of 29

Workshop Complete...

  • Feel free to reach out to me on LinkedIn or Twitter with any high-level questions.
  • I’m also open to presenting this live workshop again (not pre-recorded) through your Meetup Group.
  • For deeper-dives into this content, I’m also open to perform live/pre-recorded small-scale online half-day workshops services for your team members or organization.

That’s

ROBOCON 2022

#ROBOCON2022