Robot Framework - DnavaIC/STD-Automation-testing-icsecurity GitHub Wiki

Installation

with python previously installed, we can use pip to install the necessary libraries.

pip install robotframework robotframework-appiumlibrary robotframework-browser

Run you first script

Install GIT if you don't have already installed

Clone the repositor using git

git clone https://github.com/DnavaIC/STD-Appium-intercon.git

To run any script locally we need to use robot command + test name

robot <tests>/<your-test.robot>

In this repository you can test all the instalation with this example:

 robot tests\inter-con-app\sample-robot-appium.robot

Scripting with robot

Settings section is where imports and resources go.

*** Settings ***
Documentation  Simple example using AppiumLibrary
Library  AppiumLibrary

Its a good practice create a separate variable file.

*** Variables ***
${ANDROID_DEVICE_NAME}        Android
${ANDROID_AUTOMATION_NAME}    UiAutomator2
${ANDROID_PLATFORM_NAME}      Android
${ANDROID_APP_PACKAGE}        com.icsecurity.noakiosk
${ANDROID_APP_ACTIVITY}       com.icsecurity.fieldOfficerApp.MainActivity

The test cases are defined in this section, having natural language is the easiest way to read and understand what is happening in the script.

*** Test Cases ***
Open NO AUTH application and accept all permissions
  Open Test Application
  Accept android device permission
  Configure all time location
  Enter login number and click continue

Finally, kewords is where we define the logic of each step to be used in the testcase, it is important to follow the pre-made kewords for appium, these can be learned at Keywords guide.

in this example we use "Open Test Application" which is a pre-defined keyword and needs specific arguments.

*** Keywords ***
Open Test Application
  Open Application   http://localhost:4723     
  ...  automationName=${ANDROID_AUTOMATION_NAME}
  ...  platformName=${ANDROID_PLATFORM_NAME}
  ...  deviceName=${ANDROID_DEVICE_NAME}
  ...  appPackage=${ANDROID_APP_PACKAGE}
  ...  appActivity=${ANDROID_APP_ACTIVITY}

Keywords documentation

mobile: https://serhatbolsu.github.io/robotframework-appiumlibrary/[AppiumLibrary](https://serhatbolsu.github.io/robotframework-appiumlibrary/AppiumLibrary.html#Introduction).html#Introduction

Web: https://serhatbolsu.github.io/robotframework-appiumlibrary/[AppiumLibrary](https://serhatbolsu.github.io/robotframework-appiumlibrary/AppiumLibrary.html#Introduction).html#Introduction

⚠️ **GitHub.com Fallback** ⚠️