阿里云ubuntu18.04安装robotframwork

0. 环境

确认python和pip都已安装

# python --version

Python 2.7.15+

# pip --version

pip 19.1.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)

1. 安装robotframework

# pip install robotframework

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.

Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/

Collecting robotframework

  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/22/0f/1b9ffa0c4e59789b50e6034866e823b7d4a5c7eaedad7bfd0bba42f2aa9d/robotframework-3.1.2-py2.py3-none-any.whl (602kB)

    |████████████████████████████████| 604kB 6.9MB/s

Installing collected packages: robotframework

Successfully installed robotframework-3.1.2

2. 协议测试库rammbock和ssh库安装

# pip install robotframework-rammbock

Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/

Collecting robotframework-rammbock

  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/f5/89/9dd436822936c49932047ff224505b30fa6921b246d20f9b2134b81d17ac/robotframework-rammbock-0.4.0.1.tar.gz

Building wheels for collected packages: robotframework-rammbock

  Building wheel for robotframework-rammbock (setup.py) ... done

  Stored in directory: /root/.cache/pip/wheels/f9/e3/29/a8dea3be10e0d70451c12d47ea8435e0ee56e6a088a9d95696

Successfully built robotframework-rammbock

Installing collected packages: robotframework-rammbock

Successfully installed robotframework-rammbock-0.4.0.1

# pip install robotframework-sshlibrary

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.

Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/

Collecting robotframework-sshlibrary

  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/73/10/cf734db65f90a39b2c37d011083d2448dbd36fd560bf4201421eda9d5e39/robotframework-sshlibrary-3.3.0.tar.gz (45kB)

    |████████████████████████████████| 51kB 3.3MB/s

Requirement already satisfied: robotframework>=3.0 in /usr/local/lib/python2.7/dist-packages (from robotframework-sshlibrary) (3.1.2)

Collecting paramiko>=1.15.3 (from robotframework-sshlibrary)

  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/4b/80/74dace9e48b0ef923633dfb5e48798f58a168e4734bca8ecfaf839ba051a/paramiko-2.6.0-py2.py3-none-any.whl (199kB)

    |████████████████████████████████| 204kB 25.0MB/s

Collecting scp>=0.13.0 (from robotframework-sshlibrary)

  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/4d/7a/3d76dc5ad8deea79642f50a572e1c057cb27e8b427f83781a2c05ce4e5b6/scp-0.13.2-py2.py3-none-any.whl

Collecting pynacl>=1.0.1 (from paramiko>=1.15.3->robotframework-sshlibrary)

  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/b3/25/e605574f24948a8a53b497744e93f061eb1dbe7c44b6465fc1c172d591aa/PyNaCl-1.3.0-cp27-cp27mu-manylinux1_x86_64.whl (762kB)

    |████████████████████████████████| 768kB 4.4MB/s

Collecting bcrypt>=3.1.3 (from paramiko>=1.15.3->robotframework-sshlibrary)

  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/ad/36/9a0227d048e98409f012570f7bef8a8c2373b9c9c5dfbf82963cbae05ede/bcrypt-3.1.7-cp27-cp27mu-manylinux1_x86_64.whl (59kB)

    |████████████████████████████████| 61kB 40.4MB/s

Collecting cryptography>=2.5 (from paramiko>=1.15.3->robotframework-sshlibrary)

  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/e6/68/50698ce24c61db7d44d93a5043c621a0ca7839d4ef9dff913e6ab465fc92/cryptography-2.7-cp27-cp27mu-manylinux1_x86_64.whl (2.3MB)

    |████████████████████████████████| 2.3MB 16kB/s

Requirement already satisfied: six in /usr/local/lib/python2.7/dist-packages (from pynacl>=1.0.1->paramiko>=1.15.3->robotframework-sshlibrary) (1.12.0)

Collecting cffi>=1.4.1 (from pynacl>=1.0.1->paramiko>=1.15.3->robotframework-sshlibrary)

  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/8d/e9/0c8afd1579e5cf7bc0f06fbcd7cdb954cbc0baadd505973949a99337da1c/cffi-1.12.3-cp27-cp27mu-manylinux1_x86_64.whl (415kB)

    |████████████████████████████████| 419kB 71kB/s

Collecting asn1crypto>=0.21.0 (from cryptography>=2.5->paramiko>=1.15.3->robotframework-sshlibrary)

  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/ea/cd/35485615f45f30a510576f1a56d1e0a7ad7bd8ab5ed7cdc600ef7cd06222/asn1crypto-0.24.0-py2.py3-none-any.whl (101kB)

    |████████████████████████████████| 102kB 47.0MB/s

Collecting enum34; python_version < "3" (from cryptography>=2.5->paramiko>=1.15.3->robotframework-sshlibrary)

  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/c5/db/e56e6b4bbac7c4a06de1c50de6fe1ef3810018ae11732a50f15f62c7d050/enum34-1.1.6-py2-none-any.whl

Collecting ipaddress; python_version < "3" (from cryptography>=2.5->paramiko>=1.15.3->robotframework-sshlibrary)

  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/fc/d0/7fc3a811e011d4b388be48a0e381db8d990042df54aa4ef4599a31d39853/ipaddress-1.0.22-py2.py3-none-any.whl

Collecting pycparser (from cffi>=1.4.1->pynacl>=1.0.1->paramiko>=1.15.3->robotframework-sshlibrary)

  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz (158kB)

    |████████████████████████████████| 163kB 59.6MB/s

Building wheels for collected packages: robotframework-sshlibrary, pycparser

  Building wheel for robotframework-sshlibrary (setup.py) ... done

  Stored in directory: /root/.cache/pip/wheels/97/93/24/ddac5c0ad3a290f64d030caffd515ebabd35de90eab2acfe3a

  Building wheel for pycparser (setup.py) ... done

  Stored in directory: /root/.cache/pip/wheels/92/a2/51/5ed9eedca157b6decba18a0cf880380c9fd9ed6dca46fa791c

Successfully built robotframework-sshlibrary pycparser

Installing collected packages: pycparser, cffi, pynacl, bcrypt, asn1crypto, enum34, ipaddress, cryptography, paramiko, scp, robotframework-sshlibrary

Successfully installed asn1crypto-0.24.0 bcrypt-3.1.7 cffi-1.12.3 cryptography-2.7 enum34-1.1.6 ipaddress-1.0.22 paramiko-2.6.0 pycparser-2.19 pynacl-1.3.0 robotframework-sshlibrary-3.3.0 scp-0.13.2

参考:

https://github.com/robotframework/Rammbock/wiki/RammbockUserGuide

https://github.com/robotframework/SSHLibrary

3. 用例测试

nano rammbock.robot

*** Settings ***

Library        Rammbock

*** Test Cases ***

Send message

        Define simple protocol

        Start server

        Start client

        Send message    status:0xcafebabe

        Verify server gets status      0xcafebabe

        [Teardown]      Reset Rammbock

*** Keywords ***

Define simple protocol

        New protocol    SimpleProtocol

        u8      msgId

        u8      messageLength

        pdu    messageLength - 2

        End protocol

Start server

        Start UDP server        127.0.0.1      8282    protocol=SimpleProtocol

Start client

        Start UDP client        protocol=SimpleProtocol

        Connect        127.0.0.1      8282

Define simple message

        New message    SimpleRequest  SimpleProtocol

        u32    status

Send message

        [Arguments]    @{params}

        New message    SimpleRequest  SimpleProtocol  header:msgId:0xff

        u32    status

        Client sends message    @{params}

Verify server gets status

        [Arguments]    ${status}

        ${msg} =        Server receives message

        Should be equal        ${msg.status.hex}      ${status}

# robot --version

Robot Framework 3.1.2 (Python 2.7.15+ on linux2)

# robot rammbock.robot

==============================================================================

Rammbock                                                                     

==============================================================================

Send message                                                          | PASS |

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

Rammbock                                                              | PASS |

1 critical test, 1 passed, 0 failed

1 test total, 1 passed, 0 failed

==============================================================================

Output:  /var/www/html/output.xml

Log:    /var/www/html/log.html

Report:  /var/www/html/report.html


参考:

https://robotframework.org/

https://pypi.org/project/robotframework/

你可能感兴趣的:(阿里云ubuntu18.04安装robotframwork)