Robot Framework Automation Environment building and the first use case

Source: Internet
Author: User
Tags appium

Robot Framework Automated Environment Setup and the first script

Training Teacher: Sho Nenyu

2016/06/07

Course Purpose

I. ROBOT framework environment and first script

Course Content

1 Pre-Installation preparation work

The installation files needed to build the environment are already downloaded, and can be extracted from SVN, as follows

2 Robotframework Environment Build 2.1 Install Python

Official website: http://www.python.org/getit/

2.2 Installing setuptools-15.1

2.3 Installing PIP

2.4 Installing Selenium

2.5 Installing Wxpython

Double-click the installation file for default path installation

Official website: http://www.wxpython.org/download.php

2.6 Installing the Robotframework itself

The default path is installed one step at a

Download the website: https://pypi.python.org/pypi/robotframework/

2.7 Installing Robotframework-ride

Ride is Robotframework IDE.

Official website: http://code.google.com/p/robotframework-ride/downloads/list

Select you want to install the latest version, follow the prompts to install

The installation files are ready to be installed by default

Note: The Robotframework-ride version must match the Wxpython version, or it will not open

2.8 Installing the Selenium2library dependent library decorator

Decorator is a library of selenium2library dependencies

Official website Installation Address: https://pypi.python.org/pypi/decorator/3.4.0

On the command line, go to the installation file to extract the directory and execute the Python setup.py install installation decorator

2.9 Installation Library Selenium2library

This library is primarily used for page UI operations

Execute at the command line:

Pip Install Robotframework-selenium2library

Here robot the framework of the environment is basically completed, the following Web Automation, Appium Automation, interface automation, data-related, but also need some installation and configuration, and then Add.

After installation, there is an icon on the desktop and a double-click appears, indicating that the installation was successful.

3 Test Project 3.1 Creating a test project

3.2 First Test project

Operation Result:

To run the report:

To run the log:

4 Examples of web Automation

Below take an enrollment system login as an example to implement the first Web Automation example, start a project

Before you do Web automation, you need to add a selenium2library library under a test project or test suite, and all of the keywords in Web automation are stored in the Selenium2library library, so you need to add

Add complete, black to add the library is normal, red indicates that the library does not exist. If it is red, please check

C:\Python27\Lib\site-packages directory Whether there is a selenium2library directory or whether the name of the library is wrong, the following example, the previous 2 is the name of the wrong write

4.1 First Web test case

Code implementation:

Operation Result:

5 mobile phone-side Automation-appium Example 5.1 Appium environment building

Appium is an open-source, open-source automated testing framework for native or mobile networks and hybrid applications on IOS and Android platforms.

5.1.1 Installing node. js

Click Install file, next step to install directly, after successful installation, enter CMD open windows command prompt, enter node-v, you can see the version of node. JS, see:

Appears above, indicating that the first step installation was successful.

5.1.2 Installing the JDK

Click on the file below to install

Next step, install directly

My installation path is C:\Program files\java\jdk1.7.0_17

After the installation is complete, you need to set environment variables to make the compiler work. Right-click Computer, select Properties, select Advanced System settings on the left, and select the Advanced tab above click the Environment Variables button in the lower right corner.

The following popup dialog box will appear with user variables and system variables. The user variable is valid for the current login account, the system variable is valid for all users, and the reader can set it as needed.

How to configure environment variables/steps:

1. In the system variable click New, variable name fill java_home, variable value fill in the JDK installation path, here to fill out "C:\Program files\java\jdk1.7.0_17".

2. In the system variable, click the new variable name to fill in the Classpath, the variable value is filled ".; %java_home%\lib;%java_home%\lib\tools.jar ", be careful not to forget the front dot and the middle semicolon.

3. Locate the path variable in the system variable, which is the system's own, not new. Double-click Path, because the original variable value already exists, it should be added ";%java_home%\bin;%java_home%\jre\bin" after the existing variable. Note the preceding semicolon.

Authentication method: Enter CMD command in the Run box, enter Javac after carriage return, press ENTER to display the following screen

5.1.3 Android Environment Build-up

Unzip the adt-bundle-windows-x86_64-20140702 package and rename it: ADT

For example: I unzip to the E-drive

Configuration of the Android environment variable:

1. Configure Android_home

My Computer Right-click menu---> Properties---> Advanced---> Environment variables---> System variables--new.

2. Add%android_home%\platformtools;%android_home%\tools to path; After configuring the Post environment variable

environment variable validation : CMD open Window's command prompt, enter android-h

5.1.4 installing the. NET Framework 4.6

Double-click the next step to install directly.

Note: If the machine is already installed, you do not need to install it.

5.1.5 Installing Appium service side

Unzip the file, double-click the installation file to install the default path

C:\Program Files (x86) \appium

Environment variable configuration:

Add C:\Program Files (x86) \appium\node_modules\.bin in path;

Verify:

CMD Open command prompt, enter Appium-doctor, see:

After installation, start the Appium server in the desktop or application, start the Appium server in the upper right corner or enter the Appium in DOS.

5.1.6 Installing the Appium client

Enter CMD to open a command prompt for Windows, enter

Pip Install-u appium-python-client

5.1.7 Installing the Robotframework-appiumlibrary Library

Enter CMD to open a command prompt for Windows, enter

Pip Install-u robotframework-appiumlibrary

5.1.8 inserting the Appiumlibrary library in the Robotframe

Create a new test suite in a test project

Inserting the Appiumlibrary library in a test suite

Here basically robotframework appium environment is basic configuration, so we can write test cases.

5.2 Appium The first example of automated testing

Code implementation:

Operation Result:

Test report:

Robot Framework Automation Environment building and the first use case

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.