Skip to main content

robotframework-httpctrl is a library for Robot Framework that provides HTTP/HTTPS client and HTTP server services

Project description

HttpCtrl library for Robot Framework

RobotFramework-HttpCtrl is a library for Robot Framework that provides HTTP/HTTPS client and HTTP (IPv4 and IPv6) server services to make REST API testing easy.

License: GNU General Public License

Documentation: https://annoviko.github.io/robotframework-httpctrl/

Dependencies

Python version: >=3.4

Installation

Installation using pip3 tool:

$ pip3 install robotframework-httpctrl

Brief Overview of the Library Content

HttpCtrl contains following general libraries:

Examples

Send GET request to obtain origin IP address and check that is not empty:

*** Settings ***

Library         HttpCtrl.Client
Library         HttpCtrl.Json

*** Test Cases ***

Get Origin Address
    Initialize Client   www.httpbin.org
    Send HTTP Request   GET   /ip

    ${response status}=   Get Response Status
    ${response body}=     Get Response Body

    ${expected status}=   Convert To Integer   200
    Should Be Equal   ${response status}   ${expected status}

    ${origin}=    Get Json Value From String   ${response body}   origin
    Should Not Be Empty   ${origin}

In this example HTTP client sends POST request to HTTP server. HTTP server receives it and checks incoming request for correctness.

*** Settings ***

Library         HttpCtrl.Client
Library         HttpCtrl.Server

Test Setup       Initialize HTTP Client And Server
Test Teardown    Terminate HTTP Server

*** Test Cases ***

Receive And Reply To POST
    ${request body}=   Set Variable   { "message": "Hello!" }
    Send HTTP Request Async   POST   /post   ${request body}

    Wait For Request
    Reply By   200

    ${method}=   Get Request Method
    ${url}=      Get Request Url
    ${body}=     Get Request Body

    Should Be Equal   ${method}   POST
    Should Be Equal   ${url}      /post
    Should Be Equal   ${body}     ${request body}

*** Keywords ***

Initialize HTTP Client And Server
    Initialize Client   127.0.0.1   8000
    Start Server        127.0.0.1   8000

Terminate HTTP Server
    Stop Server

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotframework-httpctrl-0.1.10.tar.gz (26.8 kB view details)

Uploaded Source

File details

Details for the file robotframework-httpctrl-0.1.10.tar.gz.

File metadata

  • Download URL: robotframework-httpctrl-0.1.10.tar.gz
  • Upload date:
  • Size: 26.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for robotframework-httpctrl-0.1.10.tar.gz
Algorithm Hash digest
SHA256 8df08a4781676f98d4260c5dcc8f521bb6de82ae7be7906e444fd25fffd37fac
MD5 4b2c10f3b33b121d43e76048a216280c
BLAKE2b-256 b5638b567e4f999baa3b25e49eb7a1d0e25791b7c810a99344f1019e183f8405

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page