Skip to content

Samska/robot-appium-tests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Robot Framework and Appium Tests

Robot + Appium mobile tests with SauceLabs integration

This is a study project using Robot Framework + Appium for mobile tests in Android and iOS devices. This project can be run via SauceLabs as long as you have an apk configured in SauceLabs and an Ondemand URL for your account.

Getting Started

These instructions will get you a copy of the project up and running on your SauceLabs account for development and testing purposes.

Prerequisites

  • Git
  • Python 3.x
  • Pip
  • Appium

Installing

  1. Clone the repository
  2. Install the dependencies with pip install -r requirements.txt

Running the tests via SauceLabs

  1. Upload the app used in the tests of this project located at app/android/demo-saucelabs.apk and app/ios/demo-saucelabs.ipa to your SauceLabs account on https://app.saucelabs.com/app-management.
  2. Change the value of the ${SAUCELABS_REMOTE_URL} variable in the resources/android/variables/base_variables.robot and resources/ios/variables/base_variables.robot files to your Ondemand URL.
  3. Run the tests through the command robot --outputdir results tests

Capabilities

Capabilities is the name used to define the parameters used to start an Appium Session. If you want to change some of them, here is the Capabilities I used for the tests, both Android and iOS have their own base_variables.robot with their own properties.

${REMOTE_URL} - Used to establish connection with your application, e.g., http://localhost:4723/wd/hub to localhost or your Ondemand URL to connect to SauceLabs.

${PLATFORM_NAME} - The type of platform hosting the app or browser, e.g., Android or iOS

${PLATFORM_VERSION} - The version of a platform, e.g., for iOS, 16.0

${DEVICE_NAME} - The name of a particular device to automate, e.g., iPhone 14

${APP} - The path to an installable application, e.g., C:\\Users\\samska\\Desktop\\robot-appium-tests\\app\\android\\demo-saucelabs.apk

${AUTOMATION_NAME} - The name of the Appium driver to use, e.g., UiAutomator2 for Android or XCUITest for iOS

${JOB_NAME} - The name of your test, used in SauceLabs, e.g., Robot Framework Appium Tests

Continuous integration

This project has continuous integration with GitHub Actions. The configuration file is located at the path .github/workflows/robot.yml. The pipeline is scheduled to run at 00:00 every monday. With each execution, an artifact is generated with the test results and saved in that execution, as well as the results are published on the gh-pages and are available for consultation on this page.

Folder structure

robot-appium-tests/                     
 ├── .github/                               
 │    ├── workflows/                        
 │        ├── robot.yml                     # Configuration for the tests on CI
 ├── app/                                   # The app used in the tests
 │    ├── android/                          
 │        ├── demo-saucelabs.apk            # Application file for Android
 │    ├── ios/                              
 │        ├── demo-saucelabs.ipa            # Application file for iOS
 ├── config/                               
 │    ├── requirements.txt                  # Required dependencies for the tests
 │    ├── settings.robot                    # Libraries used in the tests
 ├── resources/                             # Resources like keywords and variables sorted by device type
 │    ├── android/                          
 │        ├── keywords/                     
 │          ├── setup_keywords.robot        # Keywords for setup such before and after tests
 │          ├── login_keywords.robot        # Keywords from a specific feature
 │        ├── variables/                    
 │          ├── base_variables.robot        # Base variables for integration in SauceLabs with Android
 │          ├── login_variables.robot       # Login feature elements mapped to variables
 │    ├── ios/                              
 │        ├── keywords/                     
 │          ├── setup_keywords.robot        # Keywords for setup such before and after tests
 │          ├── login_keywords.robot        # Keywords from a specific feature
 │        ├── variables/                    
 │          ├── base_variables.robot        # Base variables for integration in SauceLabs with iOS
 │          ├── login_variables.robot       # Login feature elements mapped to variables
 ├── results/                               # Test results generated by the Robot
 │    ├── log.html
 │    ├── output.xml    
 │    ├── report.html
 ├── tests/                                 # Project tests separated by device type folder                                        
 │     ├── android/                         
 |        ├── login.robot                   # Test script for login Android                                         
 │     ├── ios/                             
 |        ├── login.robot                   # Test script for login iOS                                                                         
 ├── .gitignore                             # Untracked folder and files
 ├── README.md                              # README with project overview and instructions