A simple tutorial and example of Robot Framework +appium

Source: Internet
Author: User
Tags scalar appium
a simple tutorial on Robot Framework +appium Rf+appium Introduction

Online articles more, do not repeat
Robot Framework
installation and configuration of Appium RF

Python or Jython environments are required when using the RF (Rebot framework) and can be determined according to your own needs. This article takes an example of installing and using the RF on a machine that has a Python environment.
The following packages need to be installed during the configuration process: Python 2.7, WxPython, robot framework, Robot framework ride, Robot framework Selenium Library. Installing the Python 2.7

The RF framework is based on the Python language, so be sure to have a python environment. The corresponding Python version can be downloaded from the download page below.
Download page: https://www.python.org/downloads/.
When the download is complete, select the default item to install
After installation, you need to set environment variables: computer-Properties-Advanced system settings-environment variables-system variable-path, write to C:\Python27 and C:\Python27\Scripts (change to specify the path for you).
At the same time, we can verify the installed Python information through the DOS environment.


Install adb

1. Download the Android SDK

2. New environment variable Android_home, value is SDK path

Android_home

E:\Tool\devtool\eclipse\adt-bundle-windows-x86_64-20140702\sdk\

3. Set the Platform-tools in the SDK directory to the system variable path

%android_home%

4. Verify that the ADB is well installed

Open the cmd command line to enter whether ADB has a large list of tips for adb help


Install WxPython

Download page: http://wxpython.org/download.php#stable.
When choosing a version download, be careful to select the version that corresponds to the Python version, and select the Unicode version, such as version: Wxpython2.8-win32-unicode-py26.exe, otherwise it will not support Chinese after the installation is complete.
When the download is complete, select the default item to install.
HTTPS://SOURCEFORGE.NET/PROJECTS/WXPYTHON/FILES/WXPYTHON/2.8.12.1/ Installation Pycrypto

Download page: Http://www.voidspace.org.uk/python/modules.shtml#pycrypto.
Select the corresponding Pycrypto installer version for the default installation. You need to install it before the installation library (such as shhlibrary), or you will get an error "can ' t find Vcvarsal.bat". Install Robot framwork

Go to the installation path for Python, execute the command "Pip install robotframework" or download the source https://pypi.python.org/pypi/robotframework the download page.
After decompression, execute the command "python setup.py install" for installation. Go to the installation path of Python and execute the command "Pip install Robotframework".
Pip Install Robotframework
Easy_install robotframework (3.0) installation robotframework-ride

Go to the installation path of Python and execute the command "Pip install Robotframework-ride". Install the Library you need

such as Selenium2library, Appiumlibrary,archivelibrary,sshlibrary, ftplibrary and so on. go to the installation path of Python and execute the following command: pip install Robotframework-appiumlibrary

Pip Install Robotframework-selenium2library
Pip Install Robotframework-archivelibrary
Pip Install Robotframework-sshlibrary
IP Install robotframework-ftplibrary

PS: If pip install is not available, install and configure with Easy_install Appium

Download Appium Windows Installer package on website

Official website: https://bitbucket.org/appium/appium.app/downloads/

Open Appium, as shown in the figure, the last step click Launch Open Appium Socket Server
Figure 0.Appium Configuration Diagram

After completing the previous steps, the installation and configuration of Robotframework+appium is complete and you can view the installed products by executing the command "Pip List", as shown in Figure 1:
Figure 1.RobotFramework Installation Product List
RIDE Editor Introduction Official Documents

http://robotframework.org/robotframework/#user-guide Open Ride

RF is through the RIDE editor to work, after the successful installation, execution command "[pythondir]\scripts\ride.py", you can open the RIDE editor, as shown in Figure 2. After you open it, you can create a test project, create a test case, and so on, with concrete steps in the following example.
Figure 2.RIDE Editor Startup interface


To create a test project

Select the menu bar File->new project, enter the name of the project, select directory type, and select a directory.
Figure 3. To create a test project
To create a test suite

Right-click the test project you just created, select New Suit, enter name, and select File type.
Figure 4. To create a test suite
To create a test case

Right-click the test suite you just created, select New TestCase, and enter a name.
Figure 5. To create a test case
Import Library

In the actual project, we need to use the RF framework to write web-based test cases, we need Selenium library support. Therefore, we need to load the Selenium2library library in the process of using.
Figure 6. Import Test Library

In the "Test suite" Edit tab, click the "Library" button, pop-up the input box, Name Input: appiumlibrary, click OK to complete.
If the imported library appears in red, it means that the imported library does not exist. If it is black, it means the import was successful. Writing test Cases

You can use shortcut key F5 to query the script's keywords. To open the browser as an example, enter the keyword "open" to search, query to an "open Browser" keyword, click on this keyword, it appears its usage and description, as shown in Figure 7.
Figure 7.Search Keywords

Once you are familiar with this keyword usage, try it in the test case. The "Open application" displays blue, indicating that it is a legitimate keyword, followed by a red note that requires a parameter to be entered, and, in its usage, a URL is required. More keyword usage is familiar to API files.
Figure 8.keywords Example

You can also choose to add variables when writing test cases. A variable is a commonly used function of the RF, which can be used in most parts of the test data. There are mainly the following types:
Scalar quantity: Grammatical scalar. When you use the scalar quantities in your test data, they are replaced by the assigned values. List

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.