• Stars
    star
    148
  • Rank 249,983 (Top 5 %)
  • Language
    Python
  • License
    Other
  • Created over 10 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Robot Framework test library for SSH and SFTP

SSHLibrary

Introduction

SSHLibrary is a Robot Framework test library for SSH and SFTP. The project is hosted on GitHub and downloads can be found from PyPI.

SSHLibrary is operating system independent and supports Python 2.7 as well as Python 3.4 or newer. In addition to the normal Python interpreter, it also works with Jython 2.7.

The library has the following main usages:

  • Executing commands on the remote machine, either with blocking or non-blocking behavior.
  • Writing and reading in an interactive shell.
  • Transferring files and directories over SFTP.
  • Ensuring that files and directories exist on the remote machine.
https://api.travis-ci.org/robotframework/SSHLibrary.png

Documentation

See keyword documentation for available keywords and more information about the library in general.

For general information about using test libraries with Robot Framework, see Robot Framework User Guide.

Installation

The recommended installation method is using pip:

pip install --upgrade robotframework-sshlibrary

Running this command installs also the latest Robot Framework, paramiko and scp versions. The minimum supported paramiko version is 1.15.3 and minimum supported scp version is 0.13.0. The --upgrade option can be omitted when installing the library for the first time.

With recent versions of pip it is possible to install directly from the GitHub repository. To install latest source from the master branch, use this command:

pip install git+https://github.com/robotframework/SSHLibrary.git

Alternatively you can download the source distribution from PyPI, extract it, and install it using one of the following depending are you using Python or Jython:

python setup.py install
jython setup.py install

A benefit of using pip is that it automatically installs scp, paramiko and Cryptography modules (or PyCrypto if paramiko version < 2.0) that SSHLibrary requires on Python.

On Jython, SSHLibrary requires Trilead SSH JAR distribution. You need to download Trilead SSH JAR distribution and add it to CLASSPATH.

On Windows operating system, when using Python version < 3.0, SSHLibrary will require win_inet_pton. The minimum supported win_inet_pton version is 1.1.0.

For creating SSH tunnels robotbackgroundlogger > 1.2 is also a requirement.

Docker

When installing SSHLibrary in a container (eg. Alpine Linux) there are more dependencies that must be installed: gcc, make, openssl-dev, musl-dev and libffi-dev. These packages can be installed using:

apk add gcc make openssl-dev musl-dev libffi-dev

Usage

To use SSHLibrary in Robot Framework tests, the library needs to first be imported using the Library setting as any other library.

When using Robot Framework, it is generally recommended to write as easy-to-understand tests as possible. The keywords provided by SSHLibrary are pretty low level and it is typically a good idea to write tests using Robot Framework's higher level keywords that utilize SSHLibrary keywords internally. This is illustrated by the following example where SSHLibrary keywords like Open Connection and Login are grouped together in a higher level keyword like Open Connection And Log In.

*** Settings ***
Documentation          This example demonstrates executing a command on a remote machine
...                    and getting its output.
...
...                    Notice how connections are handled as part of the suite setup and
...                    teardown. This saves some time when executing several test cases.

Library                SSHLibrary
Suite Setup            Open Connection And Log In
Suite Teardown         Close All Connections

*** Variables ***
${HOST}                localhost
${USERNAME}            test
${PASSWORD}            test

*** Test Cases ***
Execute Command And Verify Output
    [Documentation]    Execute Command can be used to run commands on the remote machine.
    ...                The keyword returns the standard output by default.
    ${output}=         Execute Command    echo Hello SSHLibrary!
    Should Be Equal    ${output}          Hello SSHLibrary!

*** Keywords ***
Open Connection And Log In
   Open Connection     ${HOST}
   Login               ${USERNAME}        ${PASSWORD}

Support

If the provided documentation is not enough, there are various support forums available:

More Repositories

1

robotframework

Generic automation framework for acceptance testing and RPA
Python
9,674
star
2

SeleniumLibrary

Web testing library for Robot Framework
Python
1,382
star
3

RIDE

Test data editor for Robot Framework
Python
958
star
4

HowToWriteGoodTestCases

General guidelines for writing good test cases using Robot Framework
408
star
5

QuickStartGuide

Robot Framework Quick Start Guide
Python
279
star
6

WebDemo

Robot Framework web testing demo using SeleniumLibrary
RobotFramework
225
star
7

PythonRemoteServer

Robot Framework remote server implemented with Python
Python
150
star
8

RobotDemo

Robot Framework demo
Python
103
star
9

robotframework.github.com

Robot Framework ecosystem from page
Vue
76
star
10

PythonLibCore

Tools to ease creating larger test libraries for Robot Framework using Python
Python
63
star
11

Selenium2Library

Web testing library for Robot Framework that has been renamed to SeleniumLibrary
Python
62
star
12

Rammbock

Rammbock - generic network protocol tester
Python
62
star
13

DbBot

DbBot is a tool to serialize Robot Framework test run results into a SQLite database.
Python
60
star
14

jrobotremoteserver

Serves remote test libraries for Robot Framework that are implemented in Java.
Java
44
star
15

JavalibCore

Base for implementing Java test libraries to be used with Robot Framework
Java
42
star
16

RemoteInterface

Introduction to the remote interface with a list of available remote servers
33
star
17

remoteswinglibrary

RemoteSwingLibrary
Python
31
star
18

DosDontsSlides

Robot Framework Dos and Don'ts
RobotFramework
26
star
19

statuschecker

Tool for validating that executed Robot Framework test cases have expected statuses and log messages.
Python
26
star
20

MavenPlugin

Maven plugin for using the Robot Framework
Java
24
star
21

swingexplorer

A project to host the swingexplorer jar files
21
star
22

BeginnersGuide

HTML
19
star
23

LibraryApiExamples

Executable examples demonstrating Robot Framework test library API.
Python
16
star
24

visual-identity

Guidelines and assets related to Robot Framework's visual identity
16
star
25

rfdoc

Automatically exported from code.google.com/p/rfdoc
Python
15
star
26

Generator

Script which generates a test project containing test libraries, test suites and resources.
Python
15
star
27

IntroSlides

Robot Framework Introduction slide set
RobotFramework
15
star
28

robotbackgroundlogger

Logger to test libraries that supports logging from threads
Python
13
star
29

OldSeleniumLibrary

Deprecated Selenium library for Robot Framework
Python
13
star
30

RemoteApplications

A Robot Framework test library that enables using libraries in external JVM.
Java
12
star
31

mabot

Automatically exported from code.google.com/p/robotframework-mabot
Python
12
star
32

JoyRide

Eclipse plugin for Robot Framework space separated data files
Java
12
star
33

HTMLChecker

Robot Framework test library for running checks and validations on HTML files
Python
12
star
34

robocon

HTML
10
star
35

pygmentslexer

Python
6
star
36

foundation

Robot Framework Foundation web pages
Vue
6
star
37

rellu

Tooling to ease creating releases
Python
6
star
38

JavatoolsTest

JDave extensions for testing Robot Framework libraries
Java
4
star
39

live

Live running Robot Framework examples that can be executed in Browser.
2
star
40

rpa

JavaScript
2
star