Remote operation of UNIX systems using the Robot framework Framework

Source: Internet
Author: User

The bot framework is a powerful automated testing framework, and the test library, written by community forces, provides it with very strong extensibility. I'll show you how to Telnet to UNIX using the extended test library provided by a third party, and do common operations on it.

    • Environment Preparation (W32 environment):
1. First we have to have the operating environment of the robot framework.    a. Python must be installed because the robot framework is implemented in Python, and currently the robot framework supports only python2.x versions.    b. Install the robot Framework, currently the latest version is 2.6.1. Installation instructions in the main page of the project gave a detailed description, see the following link      http://code.google.com/p/robotframework/downloads/list  2. To implement Robotframework access to UNIX, We need to use the SSH library to its third-party extension libraries.   If you have a strong hands-on ability, E is good, you can skip the introduction of the SSH library installation, directly to see his English installation instructions (write a bit simple). http://code.google.com/p/robotframework-sshlibrary/wiki/installationinstructions  Preparation before installation:----------------------------------------------------------------------------Pybot version:    A. Before installing sshlibrary, we need to install its support library paramiko   actually implement the software that accesses Unix function is paramiko,sshlibrary is according to robot The framework's extended Test library standard encapsulates the     Paramiko.    paramiko's homepage  http://www.lag.net/paramiko/   our download section in the page download   paramiko-1.7.7.1.zip   decompression after execution: setup.py install     installation.Note If you have more than one Python version, you must install it on a version that is consistent with robotframwork.  Multi-versioning under Windows can refer to the following stickers:http://hi.baidu.com/yobin/blog/item/f28af43650ec0f370a55a9d5.html  B.paramiko relies on another library, which provides the digital signature algorithm required by SSH, which is pycrypto and needs to be installed separately. Pycrypto is also written in Python and can be installed with the setup.py install command. ---------------------------------------------------------------------------------------------------------------

Jybot version:

Click Trilead SSH for Java download.

Add the "Classpath" item in your environment variable. So that Jython can recognize it.

---------------------------------------------------------------------------------------------------------

The installation is ready to complete.

Complete the installation preparation, we can install the SSH library, it is as follows: http://code.google.com/p/robotframework-sshlibrary/Select Sshlibrary-1.0.win32.exe This installation file is downloaded and installed. Installation is a fool, just next on the line.It's still important to note thatIf you have more than one Python version installed, you must select the corresponding Python version of the robot framework that you installed. 3. Using Ride (optional): Ride is an integrated tool written by the robot framework test case, which allows us to easily edit test cases. Ride's homepage: http://code.google.com/p/robotframework-ride/Everybody installs, here does not say more.
    • Use
Sshlibrary is used in the same way as other test libraries under other robot frameworks. By writing test cases to achieve the operation of the program being tested. Sshlibrary has hidden a lot of details for us (such as using DSA,RSA to build an encrypted channel), and it is possible to interact with UNIX with just a few keywords. Here is an example to illustrate the use of sshlibrary. Examples of the implementation of the following functions: 1. Log in to a remote UNIX server. 10.2.2.2332. Execute bash3. Switch to/userhome/lucas/config directory 4. Execute the program testTux5. Get log files/userhome/lucas/log to local directory tux_log.001 under D:\  tux_log.0016. Log out. Scripting (using ride is recommended to reduce spelling errors and use cases to be clearer in ride)The Red Word is commented:Open Connection 10.2.2.233 #None 22 Set Timeout 0minutes 3 seconds Set Prompt None Login username password Write Bash Read Until > inof used a trick to see > to show that the output was finished. Write CD /userhome/lucas/config Read Until > INFO Write Testtux Read Until > INFO Get File/userhome/lucas/log/tux_log.001      d:\tux_log.001 Note Using absolute paths Close all Connections
Save As script TestSSH.txt

Run Pybot TestSSH.txt directly, and after more than 10 seconds, the test reports and logs are generated. We can see how the use case works by looking at them.

Remote operation of UNIX systems using the Robot framework Framework

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.