Automating Mobile Apps with Appium and Robot Framework

Evangelist Apps
Evangelist Apps Blog
3 min readMay 7, 2024

--

Unknown

Mobile app automation is crucial for ensuring quality and efficiency in today’s fast-paced digital landscape. Appium and Robot Framework are powerful tools that can streamline the testing process for native, hybrid, and mobile web applications across iOS and Android platforms. In this blog post, we’ll explore how to set up and leverage these tools for effective mobile app automation.

Setting up Appium:

Appium is an open-source test automation framework that allows you to write tests for various mobile platforms using popular programming languages like Java, Python, and more. Before you can start using Appium, there are a few prerequisites you need to fulfill:

  1. Install HomeBrew (for macOS and Linux) Command: /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Install Node.js and npm Command: brew install node Download link: https://nodejs.org/
  3. Install XCode (for iOS automation) Download link: https://developer.apple.com/xcode/
  4. Install Carthage (for macOS and Linux) Command: brew install carthage Download link: https://github.com/Carthage/Carthage
  5. Install Appium desktop app Download link: https://appium.io/
  6. Install Appium Inspector Download link: https://github.com/appium/appium-inspector
  7. Install XCUITest driver (for iOS automation) Command: appium driver install xcuitest

Setting up Robot Framework:

Robot Framework is a Python-based keyword-driven testing framework that supports multiple operating systems and languages. Here are the steps to set up Robot Framework:

  1. Install Python Download link: https://www.python.org/downloads/
  2. Install PIP (Python Package Installer) PIP is usually installed with Python
  3. Ensure Python and PIP paths are added to the .bash_profile
  4. Install Robot Framework using PIP Command: pip3 install robotframework
  5. Install Selenium Library for web automation Command: pip3 install robotframework-seleniumlibrary
  6. Download and install Visual Studio Code (or preferred code editor) Download link: https://code.visualstudio.com/download
  7. Install Robot Framework Language Server extension for VSCode
  8. Install Appium library for Robot Framework Command: pip3 install — upgrade robotframework-appiumlibrary
  9. Install ImapLibrary2 for Robot Framework Command: pip3 install — upgrade robotframework-imaplibrary2

With Appium and Robot Framework set up, you can start writing automated tests for your mobile applications. Appium provides a WebDriver-compatible API that allows you to interact with mobile app elements, while Robot Framework offers a simple yet powerful syntax for creating test cases and test suites.

Here’s an example of a Robot Framework test case using the Appium library for an iOS app:

*** Settings ***
Library AppiumLibrary

*** Test Cases ***
Open iOS App and Verify Title
Open Application http://localhost:4723/wd/hub platformName=iOS deviceName=iPhone 11 app=${IOS_APP_PATH}

${appTitle} Get App Title
Should Be Equal ${appTitle} My iOS App

Enter Text and Submit Form
Input Text id=txtUsername john@example.com
Input Text id=txtPassword mypassword
Click Element id=btnSubmit

Verify Success Message
${successMsg} Get Text id=lblSuccess
Should Contain ${successMsg} Form submitted successfully

Close Application
Close Application

In this example, we’re automating an iOS app by opening the app, verifying the title, entering text into input fields, clicking a submit button, validating the success message, and finally closing the app.

Follow US For More Updates…

#EvangelistApps #Automation Testing #Testing #Selenium #Appium #Robot Framework #Testing with Python

--

--

Evangelist Apps
Evangelist Apps Blog

Evangelist Software is a UK-based mobile app development agency specializing in iOS and Android apps